diff --git a/SafeExamBrowser.Client/CompositionRoot.cs b/SafeExamBrowser.Client/CompositionRoot.cs
index 0e1249ca..42096545 100644
--- a/SafeExamBrowser.Client/CompositionRoot.cs
+++ b/SafeExamBrowser.Client/CompositionRoot.cs
@@ -82,15 +82,15 @@ namespace SafeExamBrowser.Client
InitializeLogging();
InitializeText();
- actionCenter = BuildActionCenter();
context = new ClientContext();
+ uiFactory = BuildUserInterfaceFactory();
+ actionCenter = uiFactory.CreateActionCenter();
messageBox = BuildMessageBox();
nativeMethods = new NativeMethods();
- uiFactory = BuildUserInterfaceFactory();
runtimeProxy = new RuntimeProxy(runtimeHostUri, new ProxyObjectFactory(), ModuleLogger(nameof(RuntimeProxy)), Interlocutor.Client);
systemInfo = new SystemInfo();
- taskbar = BuildTaskbar();
- taskview = BuildTaskview();
+ taskbar = uiFactory.CreateTaskbar(ModuleLogger("Taskbar"));
+ taskview = uiFactory.CreateTaskview();
var processFactory = new ProcessFactory(ModuleLogger(nameof(ProcessFactory)));
var applicationMonitor = new ApplicationMonitor(TWO_SECONDS, ModuleLogger(nameof(ApplicationMonitor)), nativeMethods, processFactory);
@@ -269,17 +269,6 @@ namespace SafeExamBrowser.Client
return operation;
}
- private IActionCenter BuildActionCenter()
- {
- switch (uiMode)
- {
- case UserInterfaceMode.Mobile:
- return new Mobile.Windows.ActionCenter();
- default:
- return new Desktop.Windows.ActionCenter();
- }
- }
-
private IFileSystemDialog BuildFileSystemDialog()
{
switch (uiMode)
@@ -296,31 +285,9 @@ namespace SafeExamBrowser.Client
switch (uiMode)
{
case UserInterfaceMode.Mobile:
- return new Mobile.MessageBox(text);
+ return new Mobile.MessageBoxFactory(text);
default:
- return new Desktop.MessageBox(text);
- }
- }
-
- private ITaskbar BuildTaskbar()
- {
- switch (uiMode)
- {
- case UserInterfaceMode.Mobile:
- return new Mobile.Windows.Taskbar(ModuleLogger(nameof(Mobile.Windows.Taskbar)));
- default:
- return new Desktop.Windows.Taskbar(ModuleLogger(nameof(Desktop.Windows.Taskbar)));
- }
- }
-
- private ITaskview BuildTaskview()
- {
- switch (uiMode)
- {
- case UserInterfaceMode.Mobile:
- return new Mobile.Windows.Taskview();
- default:
- return new Desktop.Windows.Taskview();
+ return new Desktop.MessageBoxFactory(text);
}
}
diff --git a/SafeExamBrowser.Runtime/CompositionRoot.cs b/SafeExamBrowser.Runtime/CompositionRoot.cs
index 44a04601..15f3c3e1 100644
--- a/SafeExamBrowser.Runtime/CompositionRoot.cs
+++ b/SafeExamBrowser.Runtime/CompositionRoot.cs
@@ -57,7 +57,7 @@ namespace SafeExamBrowser.Runtime
InitializeText();
var args = Environment.GetCommandLineArgs();
- var messageBox = new MessageBox(text);
+ var messageBox = new MessageBoxFactory(text);
var nativeMethods = new NativeMethods();
var uiFactory = new UserInterfaceFactory(text);
var desktopFactory = new DesktopFactory(ModuleLogger(nameof(DesktopFactory)));
diff --git a/SafeExamBrowser.UserInterface.Contracts/IUserInterfaceFactory.cs b/SafeExamBrowser.UserInterface.Contracts/IUserInterfaceFactory.cs
index cf5316f0..375f9705 100644
--- a/SafeExamBrowser.UserInterface.Contracts/IUserInterfaceFactory.cs
+++ b/SafeExamBrowser.UserInterface.Contracts/IUserInterfaceFactory.cs
@@ -34,6 +34,11 @@ namespace SafeExamBrowser.UserInterface.Contracts
///
IWindow CreateAboutWindow(AppConfig appConfig);
+ ///
+ /// Creates a new action center.
+ ///
+ IActionCenter CreateActionCenter();
+
///
/// Creates an application control for the specified application and location.
///
@@ -95,6 +100,16 @@ namespace SafeExamBrowser.UserInterface.Contracts
///
ISplashScreen CreateSplashScreen(AppConfig appConfig = null);
+ ///
+ /// Creates a new taskbar.
+ ///
+ ITaskbar CreateTaskbar(ILogger logger);
+
+ ///
+ /// Creates a new taskview.
+ ///
+ ITaskview CreateTaskview();
+
///
/// Creates a system control which allows to change the wireless network connection of the computer.
///
diff --git a/SafeExamBrowser.UserInterface.Desktop/MessageBox.cs b/SafeExamBrowser.UserInterface.Desktop/MessageBoxFactory.cs
similarity index 96%
rename from SafeExamBrowser.UserInterface.Desktop/MessageBox.cs
rename to SafeExamBrowser.UserInterface.Desktop/MessageBoxFactory.cs
index bc6eccc9..524e4fd3 100644
--- a/SafeExamBrowser.UserInterface.Desktop/MessageBox.cs
+++ b/SafeExamBrowser.UserInterface.Desktop/MessageBoxFactory.cs
@@ -14,11 +14,11 @@ using MessageBoxResult = SafeExamBrowser.UserInterface.Contracts.MessageBox.Mess
namespace SafeExamBrowser.UserInterface.Desktop
{
- public class MessageBox : IMessageBox
+ public class MessageBoxFactory : IMessageBox
{
private IText text;
- public MessageBox(IText text)
+ public MessageBoxFactory(IText text)
{
this.text = text;
}
diff --git a/SafeExamBrowser.UserInterface.Desktop/SafeExamBrowser.UserInterface.Desktop.csproj b/SafeExamBrowser.UserInterface.Desktop/SafeExamBrowser.UserInterface.Desktop.csproj
index a6979de7..b283a8fa 100644
--- a/SafeExamBrowser.UserInterface.Desktop/SafeExamBrowser.UserInterface.Desktop.csproj
+++ b/SafeExamBrowser.UserInterface.Desktop/SafeExamBrowser.UserInterface.Desktop.csproj
@@ -158,7 +158,7 @@
LogWindow.xaml
-
+
PasswordDialog.xaml
diff --git a/SafeExamBrowser.UserInterface.Desktop/UserInterfaceFactory.cs b/SafeExamBrowser.UserInterface.Desktop/UserInterfaceFactory.cs
index 67d2cfbd..3ec92cf0 100644
--- a/SafeExamBrowser.UserInterface.Desktop/UserInterfaceFactory.cs
+++ b/SafeExamBrowser.UserInterface.Desktop/UserInterfaceFactory.cs
@@ -47,6 +47,11 @@ namespace SafeExamBrowser.UserInterface.Desktop
return new AboutWindow(appConfig, text);
}
+ public IActionCenter CreateActionCenter()
+ {
+ return new ActionCenter();
+ }
+
public IApplicationControl CreateApplicationControl(IApplication application, Location location)
{
if (location == Location.ActionCenter)
@@ -180,6 +185,16 @@ namespace SafeExamBrowser.UserInterface.Desktop
return window;
}
+ public ITaskbar CreateTaskbar(ILogger logger)
+ {
+ return new Taskbar(logger);
+ }
+
+ public ITaskview CreateTaskview()
+ {
+ return new Taskview();
+ }
+
public ISystemControl CreateWirelessNetworkControl(IWirelessAdapter wirelessAdapter, Location location)
{
if (location == Location.ActionCenter)
diff --git a/SafeExamBrowser.UserInterface.Desktop/Windows/ActionCenter.xaml b/SafeExamBrowser.UserInterface.Desktop/Windows/ActionCenter.xaml
index 552d6771..4586fd67 100644
--- a/SafeExamBrowser.UserInterface.Desktop/Windows/ActionCenter.xaml
+++ b/SafeExamBrowser.UserInterface.Desktop/Windows/ActionCenter.xaml
@@ -1,4 +1,4 @@
- applications;
private LinkedListNode current;
@@ -26,7 +26,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
internal IntPtr Handle { get; private set; }
- public Taskview()
+ internal Taskview()
{
applications = new List();
controls = new LinkedList();
diff --git a/SafeExamBrowser.UserInterface.Mobile/MessageBox.cs b/SafeExamBrowser.UserInterface.Mobile/MessageBoxFactory.cs
similarity index 94%
rename from SafeExamBrowser.UserInterface.Mobile/MessageBox.cs
rename to SafeExamBrowser.UserInterface.Mobile/MessageBoxFactory.cs
index 65a48a6d..e6770942 100644
--- a/SafeExamBrowser.UserInterface.Mobile/MessageBox.cs
+++ b/SafeExamBrowser.UserInterface.Mobile/MessageBoxFactory.cs
@@ -15,11 +15,11 @@ using MessageBoxResult = SafeExamBrowser.UserInterface.Contracts.MessageBox.Mess
namespace SafeExamBrowser.UserInterface.Mobile
{
- public class MessageBox : IMessageBox
+ public class MessageBoxFactory : IMessageBox
{
private IText text;
- public MessageBox(IText text)
+ public MessageBoxFactory(IText text)
{
this.text = text;
}
diff --git a/SafeExamBrowser.UserInterface.Mobile/SafeExamBrowser.UserInterface.Mobile.csproj b/SafeExamBrowser.UserInterface.Mobile/SafeExamBrowser.UserInterface.Mobile.csproj
index f9bc4362..03e32c12 100644
--- a/SafeExamBrowser.UserInterface.Mobile/SafeExamBrowser.UserInterface.Mobile.csproj
+++ b/SafeExamBrowser.UserInterface.Mobile/SafeExamBrowser.UserInterface.Mobile.csproj
@@ -159,7 +159,7 @@
LogWindow.xaml
-
+
MessageBoxDialog.xaml
diff --git a/SafeExamBrowser.UserInterface.Mobile/UserInterfaceFactory.cs b/SafeExamBrowser.UserInterface.Mobile/UserInterfaceFactory.cs
index 3eafae20..60a42b23 100644
--- a/SafeExamBrowser.UserInterface.Mobile/UserInterfaceFactory.cs
+++ b/SafeExamBrowser.UserInterface.Mobile/UserInterfaceFactory.cs
@@ -47,6 +47,11 @@ namespace SafeExamBrowser.UserInterface.Mobile
return new AboutWindow(appConfig, text);
}
+ public IActionCenter CreateActionCenter()
+ {
+ return new ActionCenter();
+ }
+
public IApplicationControl CreateApplicationControl(IApplication application, Location location)
{
if (location == Location.ActionCenter)
@@ -180,6 +185,16 @@ namespace SafeExamBrowser.UserInterface.Mobile
return window;
}
+ public ITaskbar CreateTaskbar(ILogger logger)
+ {
+ return new Taskbar(logger);
+ }
+
+ public ITaskview CreateTaskview()
+ {
+ return new Taskview();
+ }
+
public ISystemControl CreateWirelessNetworkControl(IWirelessAdapter wirelessAdapter, Location location)
{
if (location == Location.ActionCenter)
diff --git a/SafeExamBrowser.UserInterface.Mobile/Windows/ActionCenter.xaml b/SafeExamBrowser.UserInterface.Mobile/Windows/ActionCenter.xaml
index 0378b6af..1573ce3c 100644
--- a/SafeExamBrowser.UserInterface.Mobile/Windows/ActionCenter.xaml
+++ b/SafeExamBrowser.UserInterface.Mobile/Windows/ActionCenter.xaml
@@ -1,4 +1,4 @@
- applications;
private LinkedListNode current;
@@ -26,7 +26,7 @@ namespace SafeExamBrowser.UserInterface.Mobile.Windows
internal IntPtr Handle { get; private set; }
- public Taskview()
+ internal Taskview()
{
applications = new List();
controls = new LinkedList();