Skip to content

Commit 0769cf6

Browse files
committed
SEBWIN-716, #323: Fixed issue where password dialog was visible but not having input focus during application startup.
1 parent 27f2fde commit 0769cf6

File tree

7 files changed

+27
-16
lines changed

7 files changed

+27
-16
lines changed

SafeExamBrowser.Runtime/App.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace SafeExamBrowser.Runtime
1717
public class App : Application
1818
{
1919
private static readonly Mutex Mutex = new Mutex(true, AppConfig.RUNTIME_MUTEX_NAME);
20-
private CompositionRoot instances = new CompositionRoot();
20+
private readonly CompositionRoot instances = new CompositionRoot();
2121

2222
[STAThread]
2323
public static void Main()

SafeExamBrowser.Runtime/RuntimeController.cs

+20-13
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,19 @@ namespace SafeExamBrowser.Runtime
3131
{
3232
internal class RuntimeController
3333
{
34-
private AppConfig appConfig;
35-
private ILogger logger;
36-
private IMessageBox messageBox;
37-
private IOperationSequence bootstrapSequence;
38-
private IRepeatableOperationSequence sessionSequence;
39-
private IRuntimeHost runtimeHost;
40-
private IRuntimeWindow runtimeWindow;
41-
private IServiceProxy service;
42-
private SessionContext sessionContext;
43-
private ISplashScreen splashScreen;
44-
private Action shutdown;
45-
private IText text;
46-
private IUserInterfaceFactory uiFactory;
34+
private readonly AppConfig appConfig;
35+
private readonly ILogger logger;
36+
private readonly IMessageBox messageBox;
37+
private readonly IOperationSequence bootstrapSequence;
38+
private readonly IRepeatableOperationSequence sessionSequence;
39+
private readonly IRuntimeHost runtimeHost;
40+
private readonly IRuntimeWindow runtimeWindow;
41+
private readonly IServiceProxy service;
42+
private readonly SessionContext sessionContext;
43+
private readonly ISplashScreen splashScreen;
44+
private readonly Action shutdown;
45+
private readonly IText text;
46+
private readonly IUserInterfaceFactory uiFactory;
4747

4848
private SessionConfiguration Session
4949
{
@@ -95,6 +95,13 @@ internal bool TryStart()
9595
sessionSequence.ProgressChanged += SessionSequence_ProgressChanged;
9696
sessionSequence.StatusChanged += SessionSequence_StatusChanged;
9797

98+
// We need to show the runtime window here already, this way implicitly setting it as the runtime application's main window.
99+
// Otherwise, the splash screen is considered as the main window and thus the operating system and/or WPF does not correctly
100+
// activate the runtime window once bootstrapping has finished, which in turn leads to undesired UI behavior.
101+
runtimeWindow.Show();
102+
runtimeWindow.BringToForeground();
103+
runtimeWindow.SetIndeterminate();
104+
98105
splashScreen.Show();
99106
splashScreen.BringToForeground();
100107

SafeExamBrowser.UserInterface.Contracts/IProgressIndicator.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public interface IProgressIndicator
3131
void SetIndeterminate();
3232

3333
/// <summary>
34-
/// Sets the maximum progress value.
34+
/// Sets the maximum progress value. Resets the style of the progress indicator to determinate in case it has been set to indeterminate.
3535
/// </summary>
3636
void SetMaxValue(int max);
3737

SafeExamBrowser.UserInterface.Desktop/Windows/RuntimeWindow.xaml.cs

+1
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ public void SetIndeterminate()
113113

114114
public void SetMaxValue(int max)
115115
{
116+
model.IsIndeterminate = false;
116117
model.MaxProgress = max;
117118
}
118119

SafeExamBrowser.UserInterface.Desktop/Windows/SplashScreen.xaml.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ internal partial class SplashScreen : Window, ISplashScreen
2121
{
2222
private readonly ProgressIndicatorViewModel model;
2323
private readonly IText text;
24-
24+
2525
private AppConfig appConfig;
2626
private bool allowClose;
2727

@@ -106,6 +106,7 @@ public void SetIndeterminate()
106106

107107
public void SetMaxValue(int max)
108108
{
109+
model.IsIndeterminate = false;
109110
model.MaxProgress = max;
110111
}
111112

SafeExamBrowser.UserInterface.Mobile/Windows/RuntimeWindow.xaml.cs

+1
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ public void SetIndeterminate()
113113

114114
public void SetMaxValue(int max)
115115
{
116+
model.IsIndeterminate = false;
116117
model.MaxProgress = max;
117118
}
118119

SafeExamBrowser.UserInterface.Mobile/Windows/SplashScreen.xaml.cs

+1
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ public void SetIndeterminate()
106106

107107
public void SetMaxValue(int max)
108108
{
109+
model.IsIndeterminate = false;
109110
model.MaxProgress = max;
110111
}
111112

0 commit comments

Comments
 (0)