Skip to content

feat: enter submits sign in information #90

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

Merged
merged 6 commits into from
May 8, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions App/Views/Pages/SignInTokenPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -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}" />

Expand Down
11 changes: 11 additions & 0 deletions App/Views/Pages/SignInTokenPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Coder.Desktop.App.ViewModels;
using Microsoft.UI.Xaml.Controls;
using Windows.System;

namespace Coder.Desktop.App.Views.Pages;

Expand All @@ -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;
}
}
}
6 changes: 4 additions & 2 deletions App/Views/Pages/SignInUrlPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
>

<StackPanel
Orientation="Vertical"
Expand Down Expand Up @@ -48,7 +49,8 @@
PlaceholderText="https://coder.example.com"
Loaded="{x:Bind ViewModel.CoderUrl_Loaded, Mode=OneWay}"
LostFocus="{x:Bind ViewModel.CoderUrl_FocusLost, Mode=OneWay}"
Text="{x:Bind ViewModel.CoderUrl, Mode=TwoWay}" />
Text="{x:Bind ViewModel.CoderUrl, Mode=TwoWay}"
KeyDown="TextBox_KeyDown"/>

<TextBlock
Grid.Column="1"
Expand Down
11 changes: 11 additions & 0 deletions App/Views/Pages/SignInUrlPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Coder.Desktop.App.ViewModels;
using Microsoft.UI.Xaml.Controls;
using Windows.System;

namespace Coder.Desktop.App.Views.Pages;

Expand All @@ -17,4 +18,14 @@ public SignInUrlPage(SignInWindow parent, SignInViewModel viewModel)
ViewModel = viewModel;
SignInWindow = parent;
}

private void TextBox_KeyDown(object sender, Microsoft.UI.Xaml.Input.KeyRoutedEventArgs e)
{
if(e.Key == VirtualKey.Enter)
{
ViewModel.CoderUrl = ((TextBox)sender).Text;
ViewModel.UrlPage_Next(SignInWindow);
e.Handled = true;
}
}
}
Loading