From 1dc48d2d8566139740f426e791e87258656c3016 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20=C5=A0taleker?= Date: Fri, 2 Aug 2024 11:13:53 +0200 Subject: [PATCH] login --- InfosysPublisher/WinLogin.xaml.cs | 24 +++++++++++++++++++++++- InfosysPublisher/WinMain.xaml | 1 + 2 files changed, 24 insertions(+), 1 deletion(-) 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">