diff --git a/SafeExamBrowser.Runtime/App.cs b/SafeExamBrowser.Runtime/App.cs index b1574b0d..44157a7a 100644 --- a/SafeExamBrowser.Runtime/App.cs +++ b/SafeExamBrowser.Runtime/App.cs @@ -17,7 +17,7 @@ namespace SafeExamBrowser.Runtime public class App : Application { private static readonly Mutex Mutex = new Mutex(true, AppConfig.RUNTIME_MUTEX_NAME); - private CompositionRoot instances = new CompositionRoot(); + private readonly CompositionRoot instances = new CompositionRoot(); [STAThread] public static void Main() diff --git a/SafeExamBrowser.Runtime/RuntimeController.cs b/SafeExamBrowser.Runtime/RuntimeController.cs index ccdb6202..4f3c62a1 100644 --- a/SafeExamBrowser.Runtime/RuntimeController.cs +++ b/SafeExamBrowser.Runtime/RuntimeController.cs @@ -31,19 +31,19 @@ namespace SafeExamBrowser.Runtime { internal class RuntimeController { - private AppConfig appConfig; - private ILogger logger; - private IMessageBox messageBox; - private IOperationSequence bootstrapSequence; - private IRepeatableOperationSequence sessionSequence; - private IRuntimeHost runtimeHost; - private IRuntimeWindow runtimeWindow; - private IServiceProxy service; - private SessionContext sessionContext; - private ISplashScreen splashScreen; - private Action shutdown; - private IText text; - private IUserInterfaceFactory uiFactory; + private readonly AppConfig appConfig; + private readonly ILogger logger; + private readonly IMessageBox messageBox; + private readonly IOperationSequence bootstrapSequence; + private readonly IRepeatableOperationSequence sessionSequence; + private readonly IRuntimeHost runtimeHost; + private readonly IRuntimeWindow runtimeWindow; + private readonly IServiceProxy service; + private readonly SessionContext sessionContext; + private readonly ISplashScreen splashScreen; + private readonly Action shutdown; + private readonly IText text; + private readonly IUserInterfaceFactory uiFactory; private SessionConfiguration Session { @@ -95,6 +95,13 @@ namespace SafeExamBrowser.Runtime sessionSequence.ProgressChanged += SessionSequence_ProgressChanged; sessionSequence.StatusChanged += SessionSequence_StatusChanged; + // We need to show the runtime window here already, this way implicitly setting it as the runtime application's main window. + // Otherwise, the splash screen is considered as the main window and thus the operating system and/or WPF does not correctly + // activate the runtime window once bootstrapping has finished, which in turn leads to undesired UI behavior. + runtimeWindow.Show(); + runtimeWindow.BringToForeground(); + runtimeWindow.SetIndeterminate(); + splashScreen.Show(); splashScreen.BringToForeground(); diff --git a/SafeExamBrowser.UserInterface.Contracts/IProgressIndicator.cs b/SafeExamBrowser.UserInterface.Contracts/IProgressIndicator.cs index c1ecef11..4b4a2d23 100644 --- a/SafeExamBrowser.UserInterface.Contracts/IProgressIndicator.cs +++ b/SafeExamBrowser.UserInterface.Contracts/IProgressIndicator.cs @@ -31,7 +31,7 @@ namespace SafeExamBrowser.UserInterface.Contracts void SetIndeterminate(); /// - /// Sets the maximum progress value. + /// Sets the maximum progress value. Resets the style of the progress indicator to determinate in case it has been set to indeterminate. /// void SetMaxValue(int max); diff --git a/SafeExamBrowser.UserInterface.Desktop/Windows/RuntimeWindow.xaml.cs b/SafeExamBrowser.UserInterface.Desktop/Windows/RuntimeWindow.xaml.cs index fea388f6..67071d64 100644 --- a/SafeExamBrowser.UserInterface.Desktop/Windows/RuntimeWindow.xaml.cs +++ b/SafeExamBrowser.UserInterface.Desktop/Windows/RuntimeWindow.xaml.cs @@ -113,6 +113,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows public void SetMaxValue(int max) { + model.IsIndeterminate = false; model.MaxProgress = max; } diff --git a/SafeExamBrowser.UserInterface.Desktop/Windows/SplashScreen.xaml.cs b/SafeExamBrowser.UserInterface.Desktop/Windows/SplashScreen.xaml.cs index b0e79dc0..0074b512 100644 --- a/SafeExamBrowser.UserInterface.Desktop/Windows/SplashScreen.xaml.cs +++ b/SafeExamBrowser.UserInterface.Desktop/Windows/SplashScreen.xaml.cs @@ -21,7 +21,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows { private readonly ProgressIndicatorViewModel model; private readonly IText text; - + private AppConfig appConfig; private bool allowClose; @@ -106,6 +106,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows public void SetMaxValue(int max) { + model.IsIndeterminate = false; model.MaxProgress = max; } diff --git a/SafeExamBrowser.UserInterface.Mobile/Windows/RuntimeWindow.xaml.cs b/SafeExamBrowser.UserInterface.Mobile/Windows/RuntimeWindow.xaml.cs index 52e25a94..57dde071 100644 --- a/SafeExamBrowser.UserInterface.Mobile/Windows/RuntimeWindow.xaml.cs +++ b/SafeExamBrowser.UserInterface.Mobile/Windows/RuntimeWindow.xaml.cs @@ -113,6 +113,7 @@ namespace SafeExamBrowser.UserInterface.Mobile.Windows public void SetMaxValue(int max) { + model.IsIndeterminate = false; model.MaxProgress = max; } diff --git a/SafeExamBrowser.UserInterface.Mobile/Windows/SplashScreen.xaml.cs b/SafeExamBrowser.UserInterface.Mobile/Windows/SplashScreen.xaml.cs index 4a71b802..3f9aabfe 100644 --- a/SafeExamBrowser.UserInterface.Mobile/Windows/SplashScreen.xaml.cs +++ b/SafeExamBrowser.UserInterface.Mobile/Windows/SplashScreen.xaml.cs @@ -106,6 +106,7 @@ namespace SafeExamBrowser.UserInterface.Mobile.Windows public void SetMaxValue(int max) { + model.IsIndeterminate = false; model.MaxProgress = max; }