diff --git a/InfosysPublisher/WinLogin.xaml.cs b/InfosysPublisher/WinLogin.xaml.cs index 5696fdc..aef1545 100644 --- a/InfosysPublisher/WinLogin.xaml.cs +++ b/InfosysPublisher/WinLogin.xaml.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Data; using System.Threading.Tasks; using System.Windows; +using System.Windows.Input; using InfosysPublisher.Classes; using Microsoft.Data.SqlClient; @@ -18,17 +19,38 @@ namespace InfosysPublisher public WinLogin() { InitializeComponent(); + + tbUsername.KeyDown += (sender, args) => + { + if (args.Key != Key.Enter) return; + tbPassword.Focus(); + }; + tbPassword.KeyDown += (sender, args) => + { + if (args.Key != Key.Enter) return; + Login(); + }; tblVersion.Text = $"Version: {App.CurrentVersion}"; + + tbUsername.Focus(); } - private async void Login_OnClick(object sender, RoutedEventArgs e) + private void Login_OnClick(object sender, RoutedEventArgs e) + { + Login(); + } + + private async void Login() { var succeeded = false; var isLockedOut = false; var username = tbUsername.Text; var password = tbPassword.Password; + + tbPassword.Password = ""; + User user = null; await Task.Run(() => diff --git a/InfosysPublisher/WinMain.xaml b/InfosysPublisher/WinMain.xaml index 141d454..8085e71 100644 --- a/InfosysPublisher/WinMain.xaml +++ b/InfosysPublisher/WinMain.xaml @@ -6,6 +6,7 @@ xmlns:local="clr-namespace:InfosysPublisher" mc:Ignorable="d" Icon="infosysPublisher.ico" + WindowStartupLocation="CenterScreen" Title="Infosys-Publisher" Height="445" Width="580">