From bb24c80defc9d69b3a9ccba5ff513cda87a78fb4 Mon Sep 17 00:00:00 2001 From: Michael Suchacz <203725896+ibetitsmike@users.noreply.github.com> Date: Wed, 7 May 2025 14:38:01 +0200 Subject: [PATCH 1/5] feat: enter submits sign in information --- App/Views/Pages/SignInTokenPage.xaml | 1 + App/Views/Pages/SignInTokenPage.xaml.cs | 11 +++++++++++ App/Views/Pages/SignInUrlPage.xaml | 6 ++++-- App/Views/Pages/SignInUrlPage.xaml.cs | 11 +++++++++++ 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/App/Views/Pages/SignInTokenPage.xaml b/App/Views/Pages/SignInTokenPage.xaml index 8613f19..e789347 100644 --- a/App/Views/Pages/SignInTokenPage.xaml +++ b/App/Views/Pages/SignInTokenPage.xaml @@ -62,6 +62,7 @@ Grid.Row="2" HorizontalAlignment="Stretch" PlaceholderText="Paste your token here" + KeyDown="PasswordBox_KeyDown" LostFocus="{x:Bind ViewModel.ApiToken_FocusLost, Mode=OneWay}" Password="{x:Bind ViewModel.ApiToken, Mode=TwoWay}" /> diff --git a/App/Views/Pages/SignInTokenPage.xaml.cs b/App/Views/Pages/SignInTokenPage.xaml.cs index 1219508..9f671e7 100644 --- a/App/Views/Pages/SignInTokenPage.xaml.cs +++ b/App/Views/Pages/SignInTokenPage.xaml.cs @@ -1,5 +1,6 @@ using Coder.Desktop.App.ViewModels; using Microsoft.UI.Xaml.Controls; +using Windows.System; namespace Coder.Desktop.App.Views.Pages; @@ -17,4 +18,14 @@ public SignInTokenPage(SignInWindow parent, SignInViewModel viewModel) ViewModel = viewModel; SignInWindow = parent; } + + private async void PasswordBox_KeyDown(object sender, Microsoft.UI.Xaml.Input.KeyRoutedEventArgs e) + { + if (e.Key == VirtualKey.Enter) + { + ViewModel.ApiToken = ((PasswordBox)sender).Password; + await ViewModel.TokenPage_SignIn(SignInWindow); + e.Handled = true; + } + } } diff --git a/App/Views/Pages/SignInUrlPage.xaml b/App/Views/Pages/SignInUrlPage.xaml index 76f6a3a..69be53d 100644 --- a/App/Views/Pages/SignInUrlPage.xaml +++ b/App/Views/Pages/SignInUrlPage.xaml @@ -7,7 +7,8 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" - Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> + Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" + > + Text="{x:Bind ViewModel.CoderUrl, Mode=TwoWay}" + KeyDown="TextBox_KeyDown"/> Date: Thu, 8 May 2025 09:28:38 +0200 Subject: [PATCH 2/5] Update App/Views/Pages/SignInUrlPage.xaml Co-authored-by: Dean Sheather --- App/Views/Pages/SignInUrlPage.xaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/App/Views/Pages/SignInUrlPage.xaml b/App/Views/Pages/SignInUrlPage.xaml index 69be53d..4ecbdd4 100644 --- a/App/Views/Pages/SignInUrlPage.xaml +++ b/App/Views/Pages/SignInUrlPage.xaml @@ -7,8 +7,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" - Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" - > + Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> Date: Thu, 8 May 2025 09:28:45 +0200 Subject: [PATCH 3/5] Update App/Views/Pages/SignInUrlPage.xaml Co-authored-by: Dean Sheather --- App/Views/Pages/SignInUrlPage.xaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/App/Views/Pages/SignInUrlPage.xaml b/App/Views/Pages/SignInUrlPage.xaml index 4ecbdd4..cb1667c 100644 --- a/App/Views/Pages/SignInUrlPage.xaml +++ b/App/Views/Pages/SignInUrlPage.xaml @@ -49,7 +49,7 @@ Loaded="{x:Bind ViewModel.CoderUrl_Loaded, Mode=OneWay}" LostFocus="{x:Bind ViewModel.CoderUrl_FocusLost, Mode=OneWay}" Text="{x:Bind ViewModel.CoderUrl, Mode=TwoWay}" - KeyDown="TextBox_KeyDown"/> + KeyDown="TextBox_KeyDown" /> Date: Thu, 8 May 2025 15:15:05 +0200 Subject: [PATCH 4/5] changed binding type to instead update on every keystrok --- App/Views/Pages/SignInTokenPage.xaml | 2 +- App/Views/Pages/SignInTokenPage.xaml.cs | 1 - App/Views/Pages/SignInUrlPage.xaml | 2 +- App/Views/Pages/SignInUrlPage.xaml.cs | 1 - 4 files changed, 2 insertions(+), 4 deletions(-) diff --git a/App/Views/Pages/SignInTokenPage.xaml b/App/Views/Pages/SignInTokenPage.xaml index e789347..e21b46b 100644 --- a/App/Views/Pages/SignInTokenPage.xaml +++ b/App/Views/Pages/SignInTokenPage.xaml @@ -64,7 +64,7 @@ PlaceholderText="Paste your token here" KeyDown="PasswordBox_KeyDown" LostFocus="{x:Bind ViewModel.ApiToken_FocusLost, Mode=OneWay}" - Password="{x:Bind ViewModel.ApiToken, Mode=TwoWay}" /> + Password="{x:Bind ViewModel.ApiToken, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" /> Date: Thu, 8 May 2025 16:17:12 +0200 Subject: [PATCH 5/5] fmt fixes --- App/Views/Pages/SignInUrlPage.xaml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/App/Views/Pages/SignInUrlPage.xaml.cs b/App/Views/Pages/SignInUrlPage.xaml.cs index cc1f2a8..3ba4fe3 100644 --- a/App/Views/Pages/SignInUrlPage.xaml.cs +++ b/App/Views/Pages/SignInUrlPage.xaml.cs @@ -21,7 +21,7 @@ public SignInUrlPage(SignInWindow parent, SignInViewModel viewModel) private void TextBox_KeyDown(object sender, Microsoft.UI.Xaml.Input.KeyRoutedEventArgs e) { - if(e.Key == VirtualKey.Enter) + if (e.Key == VirtualKey.Enter) { ViewModel.UrlPage_Next(SignInWindow); e.Handled = true;