SEBWIN-362: Ensured all UI element implementations are only accessible via a façade.
This commit is contained in:
parent
dc56a81760
commit
8e075264a4
21 changed files with 76 additions and 64 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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)));
|
||||
|
|
|
@ -34,6 +34,11 @@ namespace SafeExamBrowser.UserInterface.Contracts
|
|||
/// </summary>
|
||||
IWindow CreateAboutWindow(AppConfig appConfig);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new action center.
|
||||
/// </summary>
|
||||
IActionCenter CreateActionCenter();
|
||||
|
||||
/// <summary>
|
||||
/// Creates an application control for the specified application and location.
|
||||
/// </summary>
|
||||
|
@ -95,6 +100,16 @@ namespace SafeExamBrowser.UserInterface.Contracts
|
|||
/// </summary>
|
||||
ISplashScreen CreateSplashScreen(AppConfig appConfig = null);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new taskbar.
|
||||
/// </summary>
|
||||
ITaskbar CreateTaskbar(ILogger logger);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new taskview.
|
||||
/// </summary>
|
||||
ITaskview CreateTaskview();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a system control which allows to change the wireless network connection of the computer.
|
||||
/// </summary>
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -158,7 +158,7 @@
|
|||
<Compile Include="Windows\LogWindow.xaml.cs">
|
||||
<DependentUpon>LogWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MessageBox.cs" />
|
||||
<Compile Include="MessageBoxFactory.cs" />
|
||||
<Compile Include="Windows\PasswordDialog.xaml.cs">
|
||||
<DependentUpon>PasswordDialog.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<Window x:Class="SafeExamBrowser.UserInterface.Desktop.Windows.ActionCenter"
|
||||
<Window x:Class="SafeExamBrowser.UserInterface.Desktop.Windows.ActionCenter" x:ClassModifier="internal"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
|
|
|
@ -15,7 +15,7 @@ using SafeExamBrowser.UserInterface.Contracts.Shell.Events;
|
|||
|
||||
namespace SafeExamBrowser.UserInterface.Desktop.Windows
|
||||
{
|
||||
public partial class ActionCenter : Window, IActionCenter
|
||||
internal partial class ActionCenter : Window, IActionCenter
|
||||
{
|
||||
public bool ShowClock
|
||||
{
|
||||
|
@ -24,7 +24,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
|
|||
|
||||
public event QuitButtonClickedEventHandler QuitButtonClicked;
|
||||
|
||||
public ActionCenter()
|
||||
internal ActionCenter()
|
||||
{
|
||||
InitializeComponent();
|
||||
InitializeActionCenter();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<Window x:Class="SafeExamBrowser.UserInterface.Desktop.Windows.Taskbar"
|
||||
<Window x:Class="SafeExamBrowser.UserInterface.Desktop.Windows.Taskbar" x:ClassModifier="internal"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
|
|
|
@ -16,7 +16,7 @@ using SafeExamBrowser.UserInterface.Shared.Utilities;
|
|||
|
||||
namespace SafeExamBrowser.UserInterface.Desktop.Windows
|
||||
{
|
||||
public partial class Taskbar : Window, ITaskbar
|
||||
internal partial class Taskbar : Window, ITaskbar
|
||||
{
|
||||
private bool allowClose;
|
||||
private ILogger logger;
|
||||
|
@ -28,7 +28,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
|
|||
|
||||
public event QuitButtonClickedEventHandler QuitButtonClicked;
|
||||
|
||||
public Taskbar(ILogger logger)
|
||||
internal Taskbar(ILogger logger)
|
||||
{
|
||||
this.logger = logger;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<Window x:Class="SafeExamBrowser.UserInterface.Desktop.Windows.Taskview"
|
||||
<Window x:Class="SafeExamBrowser.UserInterface.Desktop.Windows.Taskview" x:ClassModifier="internal"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
|
|
|
@ -18,7 +18,7 @@ using SafeExamBrowser.UserInterface.Desktop.Controls.Taskview;
|
|||
|
||||
namespace SafeExamBrowser.UserInterface.Desktop.Windows
|
||||
{
|
||||
public partial class Taskview : Window, ITaskview
|
||||
internal partial class Taskview : Window, ITaskview
|
||||
{
|
||||
private IList<IApplication> applications;
|
||||
private LinkedListNode<WindowControl> current;
|
||||
|
@ -26,7 +26,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
|
|||
|
||||
internal IntPtr Handle { get; private set; }
|
||||
|
||||
public Taskview()
|
||||
internal Taskview()
|
||||
{
|
||||
applications = new List<IApplication>();
|
||||
controls = new LinkedList<WindowControl>();
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -159,7 +159,7 @@
|
|||
<Compile Include="Windows\LogWindow.xaml.cs">
|
||||
<DependentUpon>LogWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MessageBox.cs" />
|
||||
<Compile Include="MessageBoxFactory.cs" />
|
||||
<Compile Include="Windows\MessageBoxDialog.xaml.cs">
|
||||
<DependentUpon>MessageBoxDialog.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<Window x:Class="SafeExamBrowser.UserInterface.Mobile.Windows.ActionCenter"
|
||||
<Window x:Class="SafeExamBrowser.UserInterface.Mobile.Windows.ActionCenter" x:ClassModifier="internal"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
|
|
|
@ -15,7 +15,7 @@ using SafeExamBrowser.UserInterface.Contracts.Shell.Events;
|
|||
|
||||
namespace SafeExamBrowser.UserInterface.Mobile.Windows
|
||||
{
|
||||
public partial class ActionCenter : Window, IActionCenter
|
||||
internal partial class ActionCenter : Window, IActionCenter
|
||||
{
|
||||
public bool ShowClock
|
||||
{
|
||||
|
@ -24,7 +24,7 @@ namespace SafeExamBrowser.UserInterface.Mobile.Windows
|
|||
|
||||
public event QuitButtonClickedEventHandler QuitButtonClicked;
|
||||
|
||||
public ActionCenter()
|
||||
internal ActionCenter()
|
||||
{
|
||||
InitializeComponent();
|
||||
InitializeActionCenter();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<Window x:Class="SafeExamBrowser.UserInterface.Mobile.Windows.Taskbar"
|
||||
<Window x:Class="SafeExamBrowser.UserInterface.Mobile.Windows.Taskbar" x:ClassModifier="internal"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
|
|
|
@ -16,7 +16,7 @@ using SafeExamBrowser.UserInterface.Shared.Utilities;
|
|||
|
||||
namespace SafeExamBrowser.UserInterface.Mobile.Windows
|
||||
{
|
||||
public partial class Taskbar : Window, ITaskbar
|
||||
internal partial class Taskbar : Window, ITaskbar
|
||||
{
|
||||
private bool allowClose;
|
||||
private ILogger logger;
|
||||
|
@ -28,7 +28,7 @@ namespace SafeExamBrowser.UserInterface.Mobile.Windows
|
|||
|
||||
public event QuitButtonClickedEventHandler QuitButtonClicked;
|
||||
|
||||
public Taskbar(ILogger logger)
|
||||
internal Taskbar(ILogger logger)
|
||||
{
|
||||
this.logger = logger;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<Window x:Class="SafeExamBrowser.UserInterface.Mobile.Windows.Taskview"
|
||||
<Window x:Class="SafeExamBrowser.UserInterface.Mobile.Windows.Taskview" x:ClassModifier="internal"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
|
|
|
@ -18,7 +18,7 @@ using SafeExamBrowser.UserInterface.Mobile.Controls.Taskview;
|
|||
|
||||
namespace SafeExamBrowser.UserInterface.Mobile.Windows
|
||||
{
|
||||
public partial class Taskview : Window, ITaskview
|
||||
internal partial class Taskview : Window, ITaskview
|
||||
{
|
||||
private IList<IApplication> applications;
|
||||
private LinkedListNode<WindowControl> current;
|
||||
|
@ -26,7 +26,7 @@ namespace SafeExamBrowser.UserInterface.Mobile.Windows
|
|||
|
||||
internal IntPtr Handle { get; private set; }
|
||||
|
||||
public Taskview()
|
||||
internal Taskview()
|
||||
{
|
||||
applications = new List<IApplication>();
|
||||
controls = new LinkedList<WindowControl>();
|
||||
|
|
Loading…
Reference in a new issue