Skip to content

Commit 9b8408d

Browse files
feat: enter submits sign in information (#90)
Closes: #88 --------- Co-authored-by: Dean Sheather <dean@deansheather.com>
1 parent 2a4814e commit 9b8408d

File tree

4 files changed

+24
-2
lines changed

4 files changed

+24
-2
lines changed

App/Views/Pages/SignInTokenPage.xaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@
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}"
66-
Password="{x:Bind ViewModel.ApiToken, Mode=TwoWay}" />
67+
Password="{x:Bind ViewModel.ApiToken, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
6768

6869
<TextBlock
6970
Grid.Column="1"

App/Views/Pages/SignInTokenPage.xaml.cs

+10
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,13 @@ 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+
await ViewModel.TokenPage_SignIn(SignInWindow);
27+
e.Handled = true;
28+
}
29+
}
2030
}

App/Views/Pages/SignInUrlPage.xaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@
4848
PlaceholderText="https://coder.example.com"
4949
Loaded="{x:Bind ViewModel.CoderUrl_Loaded, Mode=OneWay}"
5050
LostFocus="{x:Bind ViewModel.CoderUrl_FocusLost, Mode=OneWay}"
51-
Text="{x:Bind ViewModel.CoderUrl, Mode=TwoWay}" />
51+
Text="{x:Bind ViewModel.CoderUrl, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
52+
KeyDown="TextBox_KeyDown"/>
5253

5354
<TextBlock
5455
Grid.Column="1"

App/Views/Pages/SignInUrlPage.xaml.cs

+10
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,13 @@ 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.UrlPage_Next(SignInWindow);
27+
e.Handled = true;
28+
}
29+
}
2030
}

0 commit comments

Comments
 (0)