SEBWIN-220: Ensured that splash screen and runtime window are always centered on the primary display.

This commit is contained in:
dbuechel 2018-09-21 14:40:48 +02:00
parent bedfc5eac0
commit b31ba1c2d5
3 changed files with 17 additions and 1 deletions

View file

@ -168,7 +168,7 @@ namespace SafeExamBrowser.Runtime.UnitTests.Operations
explorerShell.Verify(s => s.Resume(), Times.Once);
explorerShell.Verify(s => s.Terminate(), Times.Once);
explorerShell.Verify(s => s.Suspend(), Times.Once);
explorerShell.Verify(s => s.Suspend(), Times.Exactly(2));
explorerShell.Verify(s => s.Start(), Times.Once);
newDesktop.Verify(d => d.Activate(), Times.Exactly(2));
newDesktop.Verify(d => d.Close(), Times.Once);

View file

@ -44,6 +44,8 @@ namespace SafeExamBrowser.UserInterface.Classic
InitializeComponent();
InitializeRuntimeWindow();
Loaded += RuntimeWindow_Loaded;
}
public void BringToForeground()
@ -141,5 +143,11 @@ namespace SafeExamBrowser.UserInterface.Classic
Closing += (o, args) => args.Cancel = !allowClose;
}
private void RuntimeWindow_Loaded(object sender, RoutedEventArgs e)
{
Left = (SystemParameters.WorkArea.Right / 2) - (Width / 2);
Top = (SystemParameters.WorkArea.Bottom / 2) - (Height / 2);
}
}
}

View file

@ -49,6 +49,8 @@ namespace SafeExamBrowser.UserInterface.Classic
InitializeComponent();
InitializeSplashScreen();
Loaded += SplashScreen_Loaded;
}
public void BringToForeground()
@ -134,5 +136,11 @@ namespace SafeExamBrowser.UserInterface.Classic
InfoTextBlock.Inlines.Add(new Run(appConfig.ProgramCopyright) { FontSize = 10 });
}
}
private void SplashScreen_Loaded(object sender, RoutedEventArgs e)
{
Left = (SystemParameters.WorkArea.Right / 2) - (Width / 2);
Top = (SystemParameters.WorkArea.Bottom / 2) - (Height / 2);
}
}
}