Fixed usability issues with lock screen and password dialog.

This commit is contained in:
Damian Büchel 2022-07-28 12:39:58 +02:00
parent 6f9420ca8f
commit a7bb5f543a
6 changed files with 25 additions and 20 deletions

View file

@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SafeExamBrowser.UserInterface.Desktop" xmlns:local="clr-namespace:SafeExamBrowser.UserInterface.Desktop"
mc:Ignorable="d" d:DesignWidth="1500" ResizeMode="NoResize" Topmost="True" WindowState="Maximized" WindowStyle="None"> mc:Ignorable="d" d:DesignWidth="1500" ResizeMode="NoResize" Topmost="True" WindowState="Maximized" WindowStyle="None">
<Grid Background="Red"> <Grid Background="Red" FocusManager.FocusedElement="{Binding ElementName=Password}">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="*" /> <RowDefinition Height="*" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />

View file

@ -48,7 +48,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
this.text = text; this.text = text;
InitializeComponent(); InitializeComponent();
InitializeLockWindow(message, title, options); InitializeLockScreen(message, title, options);
} }
public void BringToForeground() public void BringToForeground()
@ -88,15 +88,16 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
return result; return result;
} }
private void InitializeLockWindow(string message, string title, IEnumerable<LockScreenOption> options) private void InitializeLockScreen(string message, string title, IEnumerable<LockScreenOption> options)
{ {
windows = new List<Window>(); windows = new List<Window>();
Button.Content = text.Get(TextKey.LockScreen_UnlockButton); Button.Content = text.Get(TextKey.LockScreen_UnlockButton);
Button.Click += Button_Click; Button.Click += Button_Click;
Heading.Text = title; Heading.Text = title;
Loaded += (o, args) => Activate();
Message.Text = message; Message.Text = message;
Password.KeyUp += Password_KeyUp; Password.KeyDown += Password_KeyDown;
foreach (var option in options) foreach (var option in options)
{ {
@ -164,7 +165,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
autoResetEvent.Set(); autoResetEvent.Set();
} }
private void Password_KeyUp(object sender, KeyEventArgs e) private void Password_KeyDown(object sender, KeyEventArgs e)
{ {
if (e.Key == Key.Enter) if (e.Key == Key.Enter)
{ {

View file

@ -75,16 +75,17 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
Title = title; Title = title;
WindowStartupLocation = WindowStartupLocation.CenterScreen; 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.Content = text.Get(TextKey.PasswordDialog_Cancel);
CancelButton.Click += CancelButton_Click; CancelButton.Click += CancelButton_Click;
ConfirmButton.Content = text.Get(TextKey.PasswordDialog_Confirm); ConfirmButton.Content = text.Get(TextKey.PasswordDialog_Confirm);
ConfirmButton.Click += ConfirmButton_Click; ConfirmButton.Click += ConfirmButton_Click;
Closed += (o, args) => closed?.Invoke(); Password.KeyDown += Password_KeyDown;
Closing += (o, args) => closing?.Invoke();
Loaded += (o, args) => Activate();
Password.KeyUp += Password_KeyUp;
} }
private void CancelButton_Click(object sender, RoutedEventArgs e) private void CancelButton_Click(object sender, RoutedEventArgs e)
@ -99,7 +100,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
Close(); Close();
} }
private void Password_KeyUp(object sender, KeyEventArgs e) private void Password_KeyDown(object sender, KeyEventArgs e)
{ {
if (e.Key == Key.Enter) if (e.Key == Key.Enter)
{ {

View file

@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SafeExamBrowser.UserInterface.Mobile" xmlns:local="clr-namespace:SafeExamBrowser.UserInterface.Mobile"
mc:Ignorable="d" d:DesignWidth="1500" FontSize="16" ResizeMode="NoResize" Topmost="True" WindowState="Maximized" WindowStyle="None"> mc:Ignorable="d" d:DesignWidth="1500" FontSize="16" ResizeMode="NoResize" Topmost="True" WindowState="Maximized" WindowStyle="None">
<Grid Background="Red"> <Grid Background="Red" FocusManager.FocusedElement="{Binding ElementName=Password}">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="*" /> <RowDefinition Height="*" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />

View file

@ -48,7 +48,7 @@ namespace SafeExamBrowser.UserInterface.Mobile.Windows
this.text = text; this.text = text;
InitializeComponent(); InitializeComponent();
InitializeLockWindow(message, title, options); InitializeLockScreen(message, title, options);
} }
public void BringToForeground() public void BringToForeground()
@ -88,15 +88,16 @@ namespace SafeExamBrowser.UserInterface.Mobile.Windows
return result; return result;
} }
private void InitializeLockWindow(string message, string title, IEnumerable<LockScreenOption> options) private void InitializeLockScreen(string message, string title, IEnumerable<LockScreenOption> options)
{ {
windows = new List<Window>(); windows = new List<Window>();
Button.Content = text.Get(TextKey.LockScreen_UnlockButton); Button.Content = text.Get(TextKey.LockScreen_UnlockButton);
Button.Click += Button_Click; Button.Click += Button_Click;
Heading.Text = title; Heading.Text = title;
Loaded += (o, args) => Activate();
Message.Text = message; Message.Text = message;
Password.KeyUp += Password_KeyUp; Password.KeyDown += Password_KeyDown;
foreach (var option in options) foreach (var option in options)
{ {
@ -164,7 +165,7 @@ namespace SafeExamBrowser.UserInterface.Mobile.Windows
autoResetEvent.Set(); autoResetEvent.Set();
} }
private void Password_KeyUp(object sender, KeyEventArgs e) private void Password_KeyDown(object sender, KeyEventArgs e)
{ {
if (e.Key == Key.Enter) if (e.Key == Key.Enter)
{ {

View file

@ -85,16 +85,18 @@ namespace SafeExamBrowser.UserInterface.Mobile.Windows
Message.Text = message; Message.Text = message;
Title = title; Title = title;
Closed += (o, args) => closed?.Invoke();
Closing += (o, args) => closing?.Invoke();
Loaded += (o, args) => Activate();
CancelButton.Content = text.Get(TextKey.PasswordDialog_Cancel); CancelButton.Content = text.Get(TextKey.PasswordDialog_Cancel);
CancelButton.Click += CancelButton_Click; CancelButton.Click += CancelButton_Click;
ConfirmButton.Content = text.Get(TextKey.PasswordDialog_Confirm); ConfirmButton.Content = text.Get(TextKey.PasswordDialog_Confirm);
ConfirmButton.Click += ConfirmButton_Click; ConfirmButton.Click += ConfirmButton_Click;
Closed += (o, args) => closed?.Invoke(); Password.KeyDown += Password_KeyDown;
Closing += (o, args) => closing?.Invoke();
Loaded += (o, args) => Activate();
Password.KeyUp += Password_KeyUp;
SystemParameters.StaticPropertyChanged += SystemParameters_StaticPropertyChanged; SystemParameters.StaticPropertyChanged += SystemParameters_StaticPropertyChanged;
} }
@ -110,7 +112,7 @@ namespace SafeExamBrowser.UserInterface.Mobile.Windows
Close(); Close();
} }
private void Password_KeyUp(object sender, KeyEventArgs e) private void Password_KeyDown(object sender, KeyEventArgs e)
{ {
if (e.Key == Key.Enter) if (e.Key == Key.Enter)
{ {