Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving Login page #65

Merged
merged 2 commits into from
Dec 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ProjectCoimbra.UWP/Project.Coimbra/Pages/LoginPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</StackPanel>
<StackPanel Grid.Column="1" Grid.Row="1" VerticalAlignment="Center" Padding="0,0,0,50">
<TextBlock x:Uid="LoginPage.EnterNickname" Padding="0,100,0,15" Text="Please enter your nickname:" HorizontalAlignment="Center"/>
<TextBox Name="Input_Box" Width="300" Height="25" MaxLength="100" />
<TextBox Name="Input_Box" Width="300" Height="25" MaxLength="100" KeyDown="Input_Box_OnKeyDown" />
<TextBlock x:Uid="LoginPage.Error" Margin="0,0,0,0" Name="ErrorBox" HorizontalAlignment="Center" TextAlignment="Center" Foreground="Red"
Text="{Binding OriginalText, UpdateSourceTrigger=Default}" />
<Button x:Name="LoginButton" x:Uid="LoginPage.LoginButton" Content="SIGN IN"
Expand Down
23 changes: 18 additions & 5 deletions ProjectCoimbra.UWP/Project.Coimbra/Pages/LoginPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ namespace Coimbra.Pages
{
using Coimbra.DataAccess;
using Windows.ApplicationModel.Resources;
using Windows.System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media.Animation;

/// <summary>
Expand All @@ -21,20 +23,31 @@ public LoginPage()
this.InitializeComponent();
}

private void LoginButton_Click(object sender, RoutedEventArgs e)
private void Input_Box_OnKeyDown(object sender, KeyRoutedEventArgs e)
{
if (e.Key == VirtualKey.Enter)
{
this.Submit();
}
}

private void LoginButton_Click(object sender, RoutedEventArgs e) =>
this.Submit();

private void GoToSignupPage_Click(object sender, RoutedEventArgs e) =>
this.Frame.Navigate(typeof(CreateAccountPage));

private void Submit()
{
if (DataAccess.Exists(Input_Box.Text))
{
_ = this.Frame.Navigate(typeof(ModePage), null, new DrillInNavigationTransitionInfo());
}
}
else
{
var res = ResourceLoader.GetForCurrentView();
this.ErrorBox.Text = res.GetString("LoginPage/Error");
}
}

private void GoToSignupPage_Click(object sender, RoutedEventArgs e) =>
this.Frame.Navigate(typeof(CreateAccountPage));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public ModePage() =>
this.InitializeComponent();

private void BackButton_Click(object sender, RoutedEventArgs e) =>
_ = this.Frame.Navigate(typeof(TermsPage), null, new DrillInNavigationTransitionInfo());
_ = this.Frame.Navigate(typeof(LoginPage), null, new DrillInNavigationTransitionInfo());

private void NextButton_Click(object sender, RoutedEventArgs e)
{
Expand Down