Skip to content

Commit bb24c80

Browse files
committed
feat: enter submits sign in information
1 parent 119e52a commit bb24c80

File tree

4 files changed

+27
-2
lines changed

4 files changed

+27
-2
lines changed

App/Views/Pages/SignInTokenPage.xaml

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
Grid.Row="2"
6363
HorizontalAlignment="Stretch"
6464
PlaceholderText="Paste your token here"
65+
KeyDown="PasswordBox_KeyDown"
6566
LostFocus="{x:Bind ViewModel.ApiToken_FocusLost, Mode=OneWay}"
6667
Password="{x:Bind ViewModel.ApiToken, Mode=TwoWay}" />
6768

App/Views/Pages/SignInTokenPage.xaml.cs

+11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Coder.Desktop.App.ViewModels;
22
using Microsoft.UI.Xaml.Controls;
3+
using Windows.System;
34

45
namespace Coder.Desktop.App.Views.Pages;
56

@@ -17,4 +18,14 @@ public SignInTokenPage(SignInWindow parent, SignInViewModel viewModel)
1718
ViewModel = viewModel;
1819
SignInWindow = parent;
1920
}
21+
22+
private async void PasswordBox_KeyDown(object sender, Microsoft.UI.Xaml.Input.KeyRoutedEventArgs e)
23+
{
24+
if (e.Key == VirtualKey.Enter)
25+
{
26+
ViewModel.ApiToken = ((PasswordBox)sender).Password;
27+
await ViewModel.TokenPage_SignIn(SignInWindow);
28+
e.Handled = true;
29+
}
30+
}
2031
}

App/Views/Pages/SignInUrlPage.xaml

+4-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
88
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
99
mc:Ignorable="d"
10-
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
10+
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
11+
>
1112

1213
<StackPanel
1314
Orientation="Vertical"
@@ -48,7 +49,8 @@
4849
PlaceholderText="https://coder.example.com"
4950
Loaded="{x:Bind ViewModel.CoderUrl_Loaded, Mode=OneWay}"
5051
LostFocus="{x:Bind ViewModel.CoderUrl_FocusLost, Mode=OneWay}"
51-
Text="{x:Bind ViewModel.CoderUrl, Mode=TwoWay}" />
52+
Text="{x:Bind ViewModel.CoderUrl, Mode=TwoWay}"
53+
KeyDown="TextBox_KeyDown"/>
5254

5355
<TextBlock
5456
Grid.Column="1"

App/Views/Pages/SignInUrlPage.xaml.cs

+11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Coder.Desktop.App.ViewModels;
22
using Microsoft.UI.Xaml.Controls;
3+
using Windows.System;
34

45
namespace Coder.Desktop.App.Views.Pages;
56

@@ -17,4 +18,14 @@ public SignInUrlPage(SignInWindow parent, SignInViewModel viewModel)
1718
ViewModel = viewModel;
1819
SignInWindow = parent;
1920
}
21+
22+
private void TextBox_KeyDown(object sender, Microsoft.UI.Xaml.Input.KeyRoutedEventArgs e)
23+
{
24+
if(e.Key == VirtualKey.Enter)
25+
{
26+
ViewModel.CoderUrl = ((TextBox)sender).Text;
27+
ViewModel.UrlPage_Next(SignInWindow);
28+
e.Handled = true;
29+
}
30+
}
2031
}

0 commit comments

Comments
 (0)