Skip to content

Commit

Permalink
Merge pull request #65 from EnableIrelandAT/muiriswoulfe/login
Browse files Browse the repository at this point in the history
Improving Login page
  • Loading branch information
andreasbalzer authored Dec 7, 2020
2 parents 25c068c + 6ba6462 commit f924154
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
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));
}
}
2 changes: 1 addition & 1 deletion ProjectCoimbra.UWP/Project.Coimbra/Pages/ModePage.xaml.cs
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

0 comments on commit f924154

Please sign in to comment.