From 2aaa74c7b0b7105c3fb31d9e4ccc48aed51d0c4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20B=C3=BCchel?= Date: Thu, 16 Feb 2023 17:54:40 +0100 Subject: [PATCH] SEBWIN-611: Attempt to correctly resize lockscreen on display resolution change. --- SafeExamBrowser.Client/ClientController.cs | 3 +++ .../Windows/ILockScreen.cs | 5 +++++ .../Windows/LockScreen.xaml.cs | 14 ++++++++++++++ .../Windows/LockScreen.xaml.cs | 5 +++++ 4 files changed, 27 insertions(+) diff --git a/SafeExamBrowser.Client/ClientController.cs b/SafeExamBrowser.Client/ClientController.cs index db2c3cea..9caa9044 100644 --- a/SafeExamBrowser.Client/ClientController.cs +++ b/SafeExamBrowser.Client/ClientController.cs @@ -625,9 +625,12 @@ namespace SafeExamBrowser.Client { logger.Info("Re-initializing working area..."); displayMonitor.InitializePrimaryDisplay(Settings.Taskbar.EnableTaskbar ? taskbar.GetAbsoluteHeight() : 0); + logger.Info("Re-initializing shell..."); actionCenter.InitializeBounds(); + lockScreen?.InitializeBounds(); taskbar.InitializeBounds(); + logger.Info("Desktop successfully restored."); if (!displayMonitor.ValidateConfiguration(Settings.Display).IsAllowed) diff --git a/SafeExamBrowser.UserInterface.Contracts/Windows/ILockScreen.cs b/SafeExamBrowser.UserInterface.Contracts/Windows/ILockScreen.cs index ab8656ed..e0a98d8f 100644 --- a/SafeExamBrowser.UserInterface.Contracts/Windows/ILockScreen.cs +++ b/SafeExamBrowser.UserInterface.Contracts/Windows/ILockScreen.cs @@ -20,6 +20,11 @@ namespace SafeExamBrowser.UserInterface.Contracts.Windows /// void Cancel(); + /// + /// Expands the lock screen across all active displays and resizes it accordingly. + /// + void InitializeBounds(); + /// /// Waits for the user to provide the required input to unlock the application. /// diff --git a/SafeExamBrowser.UserInterface.Desktop/Windows/LockScreen.xaml.cs b/SafeExamBrowser.UserInterface.Desktop/Windows/LockScreen.xaml.cs index 0d8ecf5d..e1eb6808 100644 --- a/SafeExamBrowser.UserInterface.Desktop/Windows/LockScreen.xaml.cs +++ b/SafeExamBrowser.UserInterface.Desktop/Windows/LockScreen.xaml.cs @@ -68,6 +68,20 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows Dispatcher.Invoke(CloseAll); } + public void InitializeBounds() + { + foreach (var window in windows) + { + window.Topmost = true; + window.WindowState = WindowState.Maximized; + window.Activate(); + } + + Topmost = true; + WindowState = WindowState.Maximized; + Activate(); + } + public new void Show() { Dispatcher.Invoke(ShowAll); diff --git a/SafeExamBrowser.UserInterface.Mobile/Windows/LockScreen.xaml.cs b/SafeExamBrowser.UserInterface.Mobile/Windows/LockScreen.xaml.cs index 12fdb849..62ccc0dd 100644 --- a/SafeExamBrowser.UserInterface.Mobile/Windows/LockScreen.xaml.cs +++ b/SafeExamBrowser.UserInterface.Mobile/Windows/LockScreen.xaml.cs @@ -68,6 +68,11 @@ namespace SafeExamBrowser.UserInterface.Mobile.Windows Dispatcher.Invoke(CloseAll); } + public void InitializeBounds() + { + // TODO + } + public new void Show() { Dispatcher.Invoke(ShowAll);