diff --git a/SafeExamBrowser.Browser/BrowserApplicationController.cs b/SafeExamBrowser.Browser/BrowserApplicationController.cs
index b4c0d379..f0ecea0c 100644
--- a/SafeExamBrowser.Browser/BrowserApplicationController.cs
+++ b/SafeExamBrowser.Browser/BrowserApplicationController.cs
@@ -36,7 +36,12 @@ namespace SafeExamBrowser.Browser
CachePath = settings.BrowserCachePath
};
- Cef.Initialize(cefSettings, true, null);
+ var success = Cef.Initialize(cefSettings, true, null);
+
+ if (!success)
+ {
+ throw new Exception("Failed to initialize the browser engine!");
+ }
}
public void RegisterApplicationButton(ITaskbarButton button)
@@ -64,13 +69,17 @@ namespace SafeExamBrowser.Browser
private void CreateNewInstance()
{
- var control = new BrowserControl("www.duckduckgo.com");
+ var control = new BrowserControl();
var window = uiFactory.CreateBrowserWindow(control);
var instance = new BrowserApplicationInstance("DuckDuckGo");
instances.Add(instance);
instance.RegisterWindow(window);
button.RegisterInstance(instance);
+
+ control.Address = "www.duckduckgo.com";
+
+ window.Display();
}
}
}
diff --git a/SafeExamBrowser.Browser/BrowserControl.cs b/SafeExamBrowser.Browser/BrowserControl.cs
index 42cf681e..c5237491 100644
--- a/SafeExamBrowser.Browser/BrowserControl.cs
+++ b/SafeExamBrowser.Browser/BrowserControl.cs
@@ -13,9 +13,5 @@ namespace SafeExamBrowser.Browser
{
class BrowserControl : ChromiumWebBrowser, IBrowserControl
{
- public BrowserControl(string url)
- {
- Address = url;
- }
}
}
diff --git a/SafeExamBrowser.Browser/SafeExamBrowser.Browser.csproj b/SafeExamBrowser.Browser/SafeExamBrowser.Browser.csproj
index 5bb20232..b3fbedcc 100644
--- a/SafeExamBrowser.Browser/SafeExamBrowser.Browser.csproj
+++ b/SafeExamBrowser.Browser/SafeExamBrowser.Browser.csproj
@@ -104,4 +104,7 @@
+
+ xcopy /E /Y "$(ProjectDir)bin\$(PlatformName)\$(ConfigurationName)" "$(SolutionDir)SafeExamBrowser\bin\$(PlatformName)\$(ConfigurationName)"
+
\ No newline at end of file
diff --git a/SafeExamBrowser.Contracts/UserInterface/IWindow.cs b/SafeExamBrowser.Contracts/UserInterface/IWindow.cs
index e8c6921d..9195cb2e 100644
--- a/SafeExamBrowser.Contracts/UserInterface/IWindow.cs
+++ b/SafeExamBrowser.Contracts/UserInterface/IWindow.cs
@@ -14,5 +14,10 @@ namespace SafeExamBrowser.Contracts.UserInterface
/// Brings the window to the foreground.
///
void BringToForeground();
+
+ ///
+ /// Shows the window to the user.
+ ///
+ void Display();
}
}
diff --git a/SafeExamBrowser.Core/Behaviour/ShutdownController.cs b/SafeExamBrowser.Core/Behaviour/ShutdownController.cs
index b9e61e61..9f459911 100644
--- a/SafeExamBrowser.Core/Behaviour/ShutdownController.cs
+++ b/SafeExamBrowser.Core/Behaviour/ShutdownController.cs
@@ -39,12 +39,12 @@ namespace SafeExamBrowser.Core.Behaviour
{
InitializeSplashScreen();
RevertOperations(operations);
- FinalizeApplicationLog();
+ FinishFinalization();
}
catch (Exception e)
{
LogAndShowException(e);
- FinalizeApplicationLog(false);
+ FinishFinalization(false);
}
}
@@ -75,7 +75,7 @@ namespace SafeExamBrowser.Core.Behaviour
uiFactory.Show(text.Get(Key.MessageBox_ShutdownError), text.Get(Key.MessageBox_ShutdownErrorTitle), icon: MessageBoxIcon.Error);
}
- private void FinalizeApplicationLog(bool success = true)
+ private void FinishFinalization(bool success = true)
{
if (success)
{
@@ -83,6 +83,7 @@ namespace SafeExamBrowser.Core.Behaviour
}
logger.Log($"{Environment.NewLine}# Application terminated at {DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")}");
+ splashScreen?.InvokeClose();
}
}
}
diff --git a/SafeExamBrowser.Core/Behaviour/StartupController.cs b/SafeExamBrowser.Core/Behaviour/StartupController.cs
index 5111f4cd..492ed7ed 100644
--- a/SafeExamBrowser.Core/Behaviour/StartupController.cs
+++ b/SafeExamBrowser.Core/Behaviour/StartupController.cs
@@ -121,7 +121,7 @@ namespace SafeExamBrowser.Core.Behaviour
if (success)
{
logger.Info("--- Application successfully initialized! ---");
- splashScreen.InvokeClose();
+ splashScreen?.InvokeClose();
}
else
{
diff --git a/SafeExamBrowser.UserInterface/BrowserWindow.xaml.cs b/SafeExamBrowser.UserInterface/BrowserWindow.xaml.cs
index f12e8de9..5c3df2c3 100644
--- a/SafeExamBrowser.UserInterface/BrowserWindow.xaml.cs
+++ b/SafeExamBrowser.UserInterface/BrowserWindow.xaml.cs
@@ -27,5 +27,10 @@ namespace SafeExamBrowser.UserInterface
{
Activate();
}
+
+ public void Display()
+ {
+ Show();
+ }
}
}