From a7bb5f543aa7a19e84218515a0cca6a93b31939b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20B=C3=BCchel?= Date: Thu, 28 Jul 2022 12:39:58 +0200 Subject: [PATCH] Fixed usability issues with lock screen and password dialog. --- .../Windows/LockScreen.xaml | 2 +- .../Windows/LockScreen.xaml.cs | 9 +++++---- .../Windows/PasswordDialog.xaml.cs | 11 ++++++----- .../Windows/LockScreen.xaml | 2 +- .../Windows/LockScreen.xaml.cs | 9 +++++---- .../Windows/PasswordDialog.xaml.cs | 12 +++++++----- 6 files changed, 25 insertions(+), 20 deletions(-) diff --git a/SafeExamBrowser.UserInterface.Desktop/Windows/LockScreen.xaml b/SafeExamBrowser.UserInterface.Desktop/Windows/LockScreen.xaml index 9ef9382b..549d705f 100644 --- a/SafeExamBrowser.UserInterface.Desktop/Windows/LockScreen.xaml +++ b/SafeExamBrowser.UserInterface.Desktop/Windows/LockScreen.xaml @@ -5,7 +5,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:SafeExamBrowser.UserInterface.Desktop" mc:Ignorable="d" d:DesignWidth="1500" ResizeMode="NoResize" Topmost="True" WindowState="Maximized" WindowStyle="None"> - + diff --git a/SafeExamBrowser.UserInterface.Desktop/Windows/LockScreen.xaml.cs b/SafeExamBrowser.UserInterface.Desktop/Windows/LockScreen.xaml.cs index a34a18fb..0e2f6b88 100644 --- a/SafeExamBrowser.UserInterface.Desktop/Windows/LockScreen.xaml.cs +++ b/SafeExamBrowser.UserInterface.Desktop/Windows/LockScreen.xaml.cs @@ -48,7 +48,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows this.text = text; InitializeComponent(); - InitializeLockWindow(message, title, options); + InitializeLockScreen(message, title, options); } public void BringToForeground() @@ -88,15 +88,16 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows return result; } - private void InitializeLockWindow(string message, string title, IEnumerable options) + private void InitializeLockScreen(string message, string title, IEnumerable options) { windows = new List(); Button.Content = text.Get(TextKey.LockScreen_UnlockButton); Button.Click += Button_Click; Heading.Text = title; + Loaded += (o, args) => Activate(); Message.Text = message; - Password.KeyUp += Password_KeyUp; + Password.KeyDown += Password_KeyDown; foreach (var option in options) { @@ -164,7 +165,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows autoResetEvent.Set(); } - private void Password_KeyUp(object sender, KeyEventArgs e) + private void Password_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { diff --git a/SafeExamBrowser.UserInterface.Desktop/Windows/PasswordDialog.xaml.cs b/SafeExamBrowser.UserInterface.Desktop/Windows/PasswordDialog.xaml.cs index 70437978..4a3b7546 100644 --- a/SafeExamBrowser.UserInterface.Desktop/Windows/PasswordDialog.xaml.cs +++ b/SafeExamBrowser.UserInterface.Desktop/Windows/PasswordDialog.xaml.cs @@ -75,16 +75,17 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows Title = title; WindowStartupLocation = WindowStartupLocation.CenterScreen; + Closed += (o, args) => closed?.Invoke(); + Closing += (o, args) => closing?.Invoke(); + Loaded += (o, args) => Activate(); + CancelButton.Content = text.Get(TextKey.PasswordDialog_Cancel); CancelButton.Click += CancelButton_Click; ConfirmButton.Content = text.Get(TextKey.PasswordDialog_Confirm); ConfirmButton.Click += ConfirmButton_Click; - Closed += (o, args) => closed?.Invoke(); - Closing += (o, args) => closing?.Invoke(); - Loaded += (o, args) => Activate(); - Password.KeyUp += Password_KeyUp; + Password.KeyDown += Password_KeyDown; } private void CancelButton_Click(object sender, RoutedEventArgs e) @@ -99,7 +100,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows Close(); } - private void Password_KeyUp(object sender, KeyEventArgs e) + private void Password_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { diff --git a/SafeExamBrowser.UserInterface.Mobile/Windows/LockScreen.xaml b/SafeExamBrowser.UserInterface.Mobile/Windows/LockScreen.xaml index b5745bf5..8dd9dd8e 100644 --- a/SafeExamBrowser.UserInterface.Mobile/Windows/LockScreen.xaml +++ b/SafeExamBrowser.UserInterface.Mobile/Windows/LockScreen.xaml @@ -5,7 +5,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:SafeExamBrowser.UserInterface.Mobile" mc:Ignorable="d" d:DesignWidth="1500" FontSize="16" ResizeMode="NoResize" Topmost="True" WindowState="Maximized" WindowStyle="None"> - + diff --git a/SafeExamBrowser.UserInterface.Mobile/Windows/LockScreen.xaml.cs b/SafeExamBrowser.UserInterface.Mobile/Windows/LockScreen.xaml.cs index dc4a5a39..728487e5 100644 --- a/SafeExamBrowser.UserInterface.Mobile/Windows/LockScreen.xaml.cs +++ b/SafeExamBrowser.UserInterface.Mobile/Windows/LockScreen.xaml.cs @@ -48,7 +48,7 @@ namespace SafeExamBrowser.UserInterface.Mobile.Windows this.text = text; InitializeComponent(); - InitializeLockWindow(message, title, options); + InitializeLockScreen(message, title, options); } public void BringToForeground() @@ -88,15 +88,16 @@ namespace SafeExamBrowser.UserInterface.Mobile.Windows return result; } - private void InitializeLockWindow(string message, string title, IEnumerable options) + private void InitializeLockScreen(string message, string title, IEnumerable options) { windows = new List(); Button.Content = text.Get(TextKey.LockScreen_UnlockButton); Button.Click += Button_Click; Heading.Text = title; + Loaded += (o, args) => Activate(); Message.Text = message; - Password.KeyUp += Password_KeyUp; + Password.KeyDown += Password_KeyDown; foreach (var option in options) { @@ -164,7 +165,7 @@ namespace SafeExamBrowser.UserInterface.Mobile.Windows autoResetEvent.Set(); } - private void Password_KeyUp(object sender, KeyEventArgs e) + private void Password_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { diff --git a/SafeExamBrowser.UserInterface.Mobile/Windows/PasswordDialog.xaml.cs b/SafeExamBrowser.UserInterface.Mobile/Windows/PasswordDialog.xaml.cs index b75bed94..2bd113a7 100644 --- a/SafeExamBrowser.UserInterface.Mobile/Windows/PasswordDialog.xaml.cs +++ b/SafeExamBrowser.UserInterface.Mobile/Windows/PasswordDialog.xaml.cs @@ -85,16 +85,18 @@ namespace SafeExamBrowser.UserInterface.Mobile.Windows Message.Text = message; Title = title; + Closed += (o, args) => closed?.Invoke(); + Closing += (o, args) => closing?.Invoke(); + Loaded += (o, args) => Activate(); + CancelButton.Content = text.Get(TextKey.PasswordDialog_Cancel); CancelButton.Click += CancelButton_Click; ConfirmButton.Content = text.Get(TextKey.PasswordDialog_Confirm); ConfirmButton.Click += ConfirmButton_Click; - Closed += (o, args) => closed?.Invoke(); - Closing += (o, args) => closing?.Invoke(); - Loaded += (o, args) => Activate(); - Password.KeyUp += Password_KeyUp; + Password.KeyDown += Password_KeyDown; + SystemParameters.StaticPropertyChanged += SystemParameters_StaticPropertyChanged; } @@ -110,7 +112,7 @@ namespace SafeExamBrowser.UserInterface.Mobile.Windows Close(); } - private void Password_KeyUp(object sender, KeyEventArgs e) + private void Password_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) {