SEBWIN-311: Moved all client controller dependencies to the client context and made context available to all client operations.
This commit is contained in:
parent
8fd22032b6
commit
3efd7fbbd0
27 changed files with 244 additions and 303 deletions
|
@ -6,12 +6,6 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using SafeExamBrowser.Browser.Contracts;
|
||||
using SafeExamBrowser.Communication.Contracts.Hosts;
|
||||
using SafeExamBrowser.Configuration.Contracts;
|
||||
using SafeExamBrowser.Settings;
|
||||
|
||||
namespace SafeExamBrowser.Client.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -19,31 +13,6 @@ namespace SafeExamBrowser.Client.Contracts
|
|||
/// </summary>
|
||||
public interface IClientController
|
||||
{
|
||||
/// <summary>
|
||||
/// The global configuration information to be used during application execution.
|
||||
/// </summary>
|
||||
AppConfig AppConfig { set; }
|
||||
|
||||
/// <summary>
|
||||
/// The browser application.
|
||||
/// </summary>
|
||||
IBrowserApplication Browser { set; }
|
||||
|
||||
/// <summary>
|
||||
/// The client host used for communication handling.
|
||||
/// </summary>
|
||||
IClientHost ClientHost { set; }
|
||||
|
||||
/// <summary>
|
||||
/// The session identifier of the currently running session.
|
||||
/// </summary>
|
||||
Guid SessionId { set; }
|
||||
|
||||
/// <summary>
|
||||
/// The settings to be used during application execution.
|
||||
/// </summary>
|
||||
AppSettings Settings { set; }
|
||||
|
||||
/// <summary>
|
||||
/// Reverts any changes, releases all used resources and terminates the client.
|
||||
/// </summary>
|
||||
|
@ -53,5 +22,10 @@ namespace SafeExamBrowser.Client.Contracts
|
|||
/// Tries to start the client. Returns <c>true</c> if successful, otherwise <c>false</c>.
|
||||
/// </summary>
|
||||
bool TryStart();
|
||||
|
||||
/// <summary>
|
||||
/// Instructs the controller to update the application configuration.
|
||||
/// </summary>
|
||||
void UpdateAppConfig();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,26 +59,10 @@
|
|||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SafeExamBrowser.Browser.Contracts\SafeExamBrowser.Browser.Contracts.csproj">
|
||||
<Project>{5fb5273d-277c-41dd-8593-a25ce1aff2e9}</Project>
|
||||
<Name>SafeExamBrowser.Browser.Contracts</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\SafeExamBrowser.Communication.Contracts\SafeExamBrowser.Communication.Contracts.csproj">
|
||||
<Project>{0cd2c5fe-711a-4c32-afe0-bb804fe8b220}</Project>
|
||||
<Name>SafeExamBrowser.Communication.Contracts</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\SafeExamBrowser.Configuration.Contracts\SafeExamBrowser.Configuration.Contracts.csproj">
|
||||
<Project>{7d74555e-63e1-4c46-bd0a-8580552368c8}</Project>
|
||||
<Name>SafeExamBrowser.Configuration.Contracts</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\SafeExamBrowser.Core.Contracts\SafeExamBrowser.Core.Contracts.csproj">
|
||||
<Project>{fe0e1224-b447-4b14-81e7-ed7d84822aa0}</Project>
|
||||
<Name>SafeExamBrowser.Core.Contracts</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\SafeExamBrowser.Settings\SafeExamBrowser.Settings.csproj">
|
||||
<Project>{30b2d907-5861-4f39-abad-c4abf1b3470e}</Project>
|
||||
<Name>SafeExamBrowser.Settings</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
|
@ -40,6 +40,7 @@ namespace SafeExamBrowser.Client.UnitTests
|
|||
private Mock<IApplicationMonitor> applicationMonitor;
|
||||
private Mock<IBrowserApplication> browserController;
|
||||
private Mock<IClientHost> clientHost;
|
||||
private ClientContext context;
|
||||
private Mock<IDisplayMonitor> displayMonitor;
|
||||
private Mock<IExplorerShell> explorerShell;
|
||||
private Mock<IHashAlgorithm> hashAlgorithm;
|
||||
|
@ -65,6 +66,7 @@ namespace SafeExamBrowser.Client.UnitTests
|
|||
applicationMonitor = new Mock<IApplicationMonitor>();
|
||||
browserController = new Mock<IBrowserApplication>();
|
||||
clientHost = new Mock<IClientHost>();
|
||||
context = new ClientContext();
|
||||
displayMonitor = new Mock<IDisplayMonitor>();
|
||||
explorerShell = new Mock<IExplorerShell>();
|
||||
hashAlgorithm = new Mock<IHashAlgorithm>();
|
||||
|
@ -87,6 +89,7 @@ namespace SafeExamBrowser.Client.UnitTests
|
|||
sut = new ClientController(
|
||||
actionCenter.Object,
|
||||
applicationMonitor.Object,
|
||||
context,
|
||||
displayMonitor.Object,
|
||||
explorerShell.Object,
|
||||
hashAlgorithm.Object,
|
||||
|
@ -100,11 +103,11 @@ namespace SafeExamBrowser.Client.UnitTests
|
|||
text.Object,
|
||||
uiFactory.Object);
|
||||
|
||||
sut.AppConfig = appConfig;
|
||||
sut.Browser = browserController.Object;
|
||||
sut.ClientHost = clientHost.Object;
|
||||
sut.SessionId = sessionId;
|
||||
sut.Settings = settings;
|
||||
context.AppConfig = appConfig;
|
||||
context.Browser = browserController.Object;
|
||||
context.ClientHost = clientHost.Object;
|
||||
context.SessionId = sessionId;
|
||||
context.Settings = settings;
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
@ -540,8 +543,8 @@ namespace SafeExamBrowser.Client.UnitTests
|
|||
[TestMethod]
|
||||
public void Shutdown_MustNotFailIfDependenciesAreNull()
|
||||
{
|
||||
sut.Browser = null;
|
||||
sut.ClientHost = null;
|
||||
context.Browser = null;
|
||||
context.ClientHost = null;
|
||||
|
||||
sut.Terminate();
|
||||
}
|
||||
|
@ -591,7 +594,7 @@ namespace SafeExamBrowser.Client.UnitTests
|
|||
uiFactory.Setup(u => u.CreateSplashScreen(It.IsAny<AppConfig>())).Returns(splashScreen.Object);
|
||||
|
||||
sut.TryStart();
|
||||
sut.AppConfig = appConfig;
|
||||
sut.UpdateAppConfig();
|
||||
|
||||
splashScreen.VerifySet(s => s.AppConfig = appConfig, Times.Once);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Moq;
|
||||
using SafeExamBrowser.Applications.Contracts;
|
||||
using SafeExamBrowser.Browser.Contracts;
|
||||
using SafeExamBrowser.Client.Operations;
|
||||
using SafeExamBrowser.Logging.Contracts;
|
||||
using SafeExamBrowser.UserInterface.Contracts;
|
||||
|
@ -20,7 +20,8 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
|
|||
public class BrowserOperationTests
|
||||
{
|
||||
private Mock<IActionCenter> actionCenter;
|
||||
private Mock<IApplication> application;
|
||||
private Mock<IBrowserApplication> browser;
|
||||
private ClientContext context;
|
||||
private Mock<ILogger> logger;
|
||||
private Mock<ITaskbar> taskbar;
|
||||
private Mock<IUserInterfaceFactory> uiFactory;
|
||||
|
@ -31,12 +32,15 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
|
|||
public void Initialize()
|
||||
{
|
||||
actionCenter = new Mock<IActionCenter>();
|
||||
application = new Mock<IApplication>();
|
||||
browser = new Mock<IBrowserApplication>();
|
||||
context = new ClientContext();
|
||||
logger = new Mock<ILogger>();
|
||||
taskbar = new Mock<ITaskbar>();
|
||||
uiFactory = new Mock<IUserInterfaceFactory>();
|
||||
|
||||
sut = new BrowserOperation(actionCenter.Object, application.Object, logger.Object, taskbar.Object, uiFactory.Object);
|
||||
context.Browser = browser.Object;
|
||||
|
||||
sut = new BrowserOperation(actionCenter.Object, context, logger.Object, taskbar.Object, uiFactory.Object);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
@ -44,7 +48,7 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
|
|||
{
|
||||
sut.Perform();
|
||||
|
||||
application.Verify(c => c.Initialize(), Times.Once);
|
||||
browser.Verify(c => c.Initialize(), Times.Once);
|
||||
actionCenter.Verify(a => a.AddApplicationControl(It.IsAny<IApplicationControl>()), Times.Once);
|
||||
taskbar.Verify(t => t.AddApplicationControl(It.IsAny<IApplicationControl>()), Times.Once);
|
||||
}
|
||||
|
@ -53,7 +57,7 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
|
|||
public void MustRevertCorrectly()
|
||||
{
|
||||
sut.Revert();
|
||||
application.Verify(c => c.Terminate(), Times.Once);
|
||||
browser.Verify(c => c.Terminate(), Times.Once);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
*/
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Moq;
|
||||
|
@ -22,6 +21,7 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
|
|||
public class ClientHostDisconnectionOperationTests
|
||||
{
|
||||
private Mock<IClientHost> clientHost;
|
||||
private ClientContext context;
|
||||
private Mock<ILogger> logger;
|
||||
|
||||
private ClientHostDisconnectionOperation sut;
|
||||
|
@ -30,9 +30,12 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
|
|||
public void Initialize()
|
||||
{
|
||||
clientHost = new Mock<IClientHost>();
|
||||
context = new ClientContext();
|
||||
logger = new Mock<ILogger>();
|
||||
|
||||
sut = new ClientHostDisconnectionOperation(clientHost.Object, logger.Object, 0);
|
||||
context.ClientHost = clientHost.Object;
|
||||
|
||||
sut = new ClientHostDisconnectionOperation(context, logger.Object, 0);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
@ -42,7 +45,7 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
|
|||
var before = default(DateTime);
|
||||
var timeout_ms = 200;
|
||||
|
||||
sut = new ClientHostDisconnectionOperation(clientHost.Object, logger.Object, timeout_ms);
|
||||
sut = new ClientHostDisconnectionOperation(context, logger.Object, timeout_ms);
|
||||
|
||||
clientHost.SetupGet(h => h.IsConnected).Returns(true).Callback(() => Task.Delay(10).ContinueWith((_) =>
|
||||
{
|
||||
|
@ -66,7 +69,7 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
|
|||
var before = default(DateTime);
|
||||
var timeout_ms = 200;
|
||||
|
||||
sut = new ClientHostDisconnectionOperation(clientHost.Object, logger.Object, timeout_ms);
|
||||
sut = new ClientHostDisconnectionOperation(context, logger.Object, timeout_ms);
|
||||
|
||||
clientHost.SetupGet(h => h.IsConnected).Returns(true);
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
|
|||
[TestClass]
|
||||
public class ClipboardOperationTests
|
||||
{
|
||||
private ClientContext context;
|
||||
private Mock<ILogger> loggerMock;
|
||||
private Mock<INativeMethods> nativeMethodsMock;
|
||||
|
||||
|
@ -25,10 +26,11 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
|
|||
[TestInitialize]
|
||||
public void Initialize()
|
||||
{
|
||||
context = new ClientContext();
|
||||
loggerMock = new Mock<ILogger>();
|
||||
nativeMethodsMock = new Mock<INativeMethods>();
|
||||
|
||||
sut = new ClipboardOperation(loggerMock.Object, nativeMethodsMock.Object);
|
||||
sut = new ClipboardOperation(context, loggerMock.Object, nativeMethodsMock.Object);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
|
|
@ -22,7 +22,6 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
|
|||
[TestClass]
|
||||
public class ConfigurationOperationTests
|
||||
{
|
||||
private ClientConfiguration configuration;
|
||||
private ClientContext context;
|
||||
private Mock<ILogger> logger;
|
||||
private Mock<IRuntimeProxy> runtime;
|
||||
|
@ -31,12 +30,11 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
|
|||
[TestInitialize]
|
||||
public void Initialize()
|
||||
{
|
||||
configuration = new ClientConfiguration();
|
||||
context = new ClientContext();
|
||||
logger = new Mock<ILogger>();
|
||||
runtime = new Mock<IRuntimeProxy>();
|
||||
|
||||
sut = new ConfigurationOperation(configuration, context, logger.Object, runtime.Object);
|
||||
sut = new ConfigurationOperation(context, logger.Object, runtime.Object);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
@ -56,9 +54,9 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
|
|||
|
||||
var result = sut.Perform();
|
||||
|
||||
Assert.AreSame(configuration.AppConfig, response.Configuration.AppConfig);
|
||||
Assert.AreEqual(configuration.SessionId, response.Configuration.SessionId);
|
||||
Assert.AreSame(configuration.Settings, response.Configuration.Settings);
|
||||
Assert.AreSame(context.AppConfig, response.Configuration.AppConfig);
|
||||
Assert.AreEqual(context.SessionId, response.Configuration.SessionId);
|
||||
Assert.AreSame(context.Settings, response.Configuration.Settings);
|
||||
Assert.AreEqual(OperationResult.Success, result);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
|
|||
[TestClass]
|
||||
public class DisplayMonitorOperationTests
|
||||
{
|
||||
private ClientContext context;
|
||||
private Mock<IDisplayMonitor> displayMonitorMock;
|
||||
private Mock<ILogger> loggerMock;
|
||||
private Mock<ITaskbar> taskbarMock;
|
||||
|
@ -27,11 +28,12 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
|
|||
[TestInitialize]
|
||||
public void Initialize()
|
||||
{
|
||||
loggerMock = new Mock<ILogger>();
|
||||
context = new ClientContext();
|
||||
displayMonitorMock = new Mock<IDisplayMonitor>();
|
||||
loggerMock = new Mock<ILogger>();
|
||||
taskbarMock = new Mock<ITaskbar>();
|
||||
|
||||
sut = new DisplayMonitorOperation(displayMonitorMock.Object, loggerMock.Object, taskbarMock.Object);
|
||||
sut = new DisplayMonitorOperation(context, displayMonitorMock.Object, loggerMock.Object, taskbarMock.Object);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
|
|||
[TestClass]
|
||||
public class KeyboardInterceptorOperationTests
|
||||
{
|
||||
private ClientContext context;
|
||||
private Mock<IKeyboardInterceptor> keyboardInterceptorMock;
|
||||
private Mock<ILogger> loggerMock;
|
||||
|
||||
|
@ -25,10 +26,11 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
|
|||
[TestInitialize]
|
||||
public void Initialize()
|
||||
{
|
||||
context = new ClientContext();
|
||||
keyboardInterceptorMock = new Mock<IKeyboardInterceptor>();
|
||||
loggerMock = new Mock<ILogger>();
|
||||
|
||||
sut = new KeyboardInterceptorOperation(keyboardInterceptorMock.Object, loggerMock.Object);
|
||||
sut = new KeyboardInterceptorOperation(context, keyboardInterceptorMock.Object, loggerMock.Object);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
|
|||
[TestClass]
|
||||
public class MouseInterceptorOperationTests
|
||||
{
|
||||
private ClientContext context;
|
||||
private Mock<IMouseInterceptor> mouseInterceptorMock;
|
||||
private Mock<ILogger> loggerMock;
|
||||
|
||||
|
@ -25,10 +26,11 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
|
|||
[TestInitialize]
|
||||
public void Initialize()
|
||||
{
|
||||
context = new ClientContext();
|
||||
mouseInterceptorMock = new Mock<IMouseInterceptor>();
|
||||
loggerMock = new Mock<ILogger>();
|
||||
|
||||
sut = new MouseInterceptorOperation(loggerMock.Object, mouseInterceptorMock.Object);
|
||||
sut = new MouseInterceptorOperation(context, loggerMock.Object, mouseInterceptorMock.Object);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
|
|
@ -19,6 +19,7 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
|
|||
[TestClass]
|
||||
public class RuntimeConnectionOperationTests
|
||||
{
|
||||
private ClientContext context;
|
||||
private Mock<ILogger> logger;
|
||||
private Mock<IRuntimeProxy> runtime;
|
||||
private Guid token;
|
||||
|
@ -27,11 +28,12 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
|
|||
[TestInitialize]
|
||||
public void Initialize()
|
||||
{
|
||||
context = new ClientContext();
|
||||
logger = new Mock<ILogger>();
|
||||
runtime = new Mock<IRuntimeProxy>();
|
||||
token = Guid.NewGuid();
|
||||
|
||||
sut = new RuntimeConnectionOperation(logger.Object, runtime.Object, token);
|
||||
sut = new RuntimeConnectionOperation(context, logger.Object, runtime.Object, token);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
|
|
@ -11,9 +11,9 @@ using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|||
using Moq;
|
||||
using SafeExamBrowser.Client.Contracts;
|
||||
using SafeExamBrowser.Client.Operations;
|
||||
using SafeExamBrowser.Settings.UserInterface;
|
||||
using SafeExamBrowser.I18n.Contracts;
|
||||
using SafeExamBrowser.Logging.Contracts;
|
||||
using SafeExamBrowser.Settings;
|
||||
using SafeExamBrowser.SystemComponents.Contracts;
|
||||
using SafeExamBrowser.SystemComponents.Contracts.Audio;
|
||||
using SafeExamBrowser.SystemComponents.Contracts.Keyboard;
|
||||
|
@ -30,10 +30,9 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
|
|||
{
|
||||
private Mock<IActionCenter> actionCenter;
|
||||
private List<IActionCenterActivator> activators;
|
||||
private ActionCenterSettings actionCenterSettings;
|
||||
private Mock<IAudio> audio;
|
||||
private ClientContext context;
|
||||
private Mock<ILogger> logger;
|
||||
private TaskbarSettings taskbarSettings;
|
||||
private Mock<ITerminationActivator> terminationActivator;
|
||||
private Mock<INotificationInfo> aboutInfo;
|
||||
private Mock<INotificationController> aboutController;
|
||||
|
@ -54,8 +53,8 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
|
|||
{
|
||||
actionCenter = new Mock<IActionCenter>();
|
||||
activators = new List<IActionCenterActivator>();
|
||||
actionCenterSettings = new ActionCenterSettings();
|
||||
audio = new Mock<IAudio>();
|
||||
context = new ClientContext();
|
||||
logger = new Mock<ILogger>();
|
||||
aboutInfo = new Mock<INotificationInfo>();
|
||||
aboutController = new Mock<INotificationController>();
|
||||
|
@ -65,12 +64,13 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
|
|||
powerSupply = new Mock<IPowerSupply>();
|
||||
systemInfo = new Mock<ISystemInfo>();
|
||||
taskbar = new Mock<ITaskbar>();
|
||||
taskbarSettings = new TaskbarSettings();
|
||||
terminationActivator = new Mock<ITerminationActivator>();
|
||||
text = new Mock<IText>();
|
||||
uiFactory = new Mock<IUserInterfaceFactory>();
|
||||
wirelessAdapter = new Mock<IWirelessAdapter>();
|
||||
|
||||
context.Settings = new AppSettings();
|
||||
|
||||
uiFactory
|
||||
.Setup(u => u.CreateNotificationControl(It.IsAny<INotificationController>(), It.IsAny<INotificationInfo>(), It.IsAny<Location>()))
|
||||
.Returns(new Mock<INotificationControl>().Object);
|
||||
|
@ -78,10 +78,10 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
|
|||
sut = new ShellOperation(
|
||||
actionCenter.Object,
|
||||
activators,
|
||||
actionCenterSettings,
|
||||
audio.Object,
|
||||
aboutInfo.Object,
|
||||
aboutController.Object,
|
||||
context,
|
||||
keyboard.Object,
|
||||
logger.Object,
|
||||
logInfo.Object,
|
||||
|
@ -89,7 +89,6 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
|
|||
powerSupply.Object,
|
||||
systemInfo.Object,
|
||||
taskbar.Object,
|
||||
taskbarSettings,
|
||||
terminationActivator.Object,
|
||||
text.Object,
|
||||
uiFactory.Object,
|
||||
|
@ -106,7 +105,7 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
|
|||
new Mock<IActionCenterActivator>()
|
||||
};
|
||||
|
||||
actionCenterSettings.EnableActionCenter = true;
|
||||
context.Settings.ActionCenter.EnableActionCenter = true;
|
||||
|
||||
foreach (var activator in activatorMocks)
|
||||
{
|
||||
|
@ -126,10 +125,10 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
|
|||
[TestMethod]
|
||||
public void Perform_MustInitializeClock()
|
||||
{
|
||||
actionCenterSettings.EnableActionCenter = true;
|
||||
actionCenterSettings.ShowClock = true;
|
||||
taskbarSettings.EnableTaskbar = true;
|
||||
taskbarSettings.ShowClock = true;
|
||||
context.Settings.ActionCenter.EnableActionCenter = true;
|
||||
context.Settings.ActionCenter.ShowClock = true;
|
||||
context.Settings.Taskbar.EnableTaskbar = true;
|
||||
context.Settings.Taskbar.ShowClock = true;
|
||||
|
||||
sut.Perform();
|
||||
|
||||
|
@ -140,10 +139,10 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
|
|||
[TestMethod]
|
||||
public void Perform_MustNotInitializeClock()
|
||||
{
|
||||
actionCenterSettings.EnableActionCenter = true;
|
||||
actionCenterSettings.ShowClock = false;
|
||||
taskbarSettings.EnableTaskbar = true;
|
||||
taskbarSettings.ShowClock = false;
|
||||
context.Settings.ActionCenter.EnableActionCenter = true;
|
||||
context.Settings.ActionCenter.ShowClock = false;
|
||||
context.Settings.Taskbar.EnableTaskbar = true;
|
||||
context.Settings.Taskbar.ShowClock = false;
|
||||
|
||||
sut.Perform();
|
||||
|
||||
|
@ -154,12 +153,12 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
|
|||
[TestMethod]
|
||||
public void Perform_MustInitializeNotifications()
|
||||
{
|
||||
actionCenterSettings.EnableActionCenter = true;
|
||||
actionCenterSettings.ShowApplicationInfo = true;
|
||||
actionCenterSettings.ShowApplicationLog = true;
|
||||
taskbarSettings.EnableTaskbar = true;
|
||||
taskbarSettings.ShowApplicationInfo = true;
|
||||
taskbarSettings.ShowApplicationLog = true;
|
||||
context.Settings.ActionCenter.EnableActionCenter = true;
|
||||
context.Settings.ActionCenter.ShowApplicationInfo = true;
|
||||
context.Settings.ActionCenter.ShowApplicationLog = true;
|
||||
context.Settings.Taskbar.EnableTaskbar = true;
|
||||
context.Settings.Taskbar.ShowApplicationInfo = true;
|
||||
context.Settings.Taskbar.ShowApplicationLog = true;
|
||||
|
||||
sut.Perform();
|
||||
|
||||
|
@ -172,10 +171,10 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
|
|||
{
|
||||
var logControl = new Mock<INotificationControl>();
|
||||
|
||||
actionCenterSettings.EnableActionCenter = true;
|
||||
actionCenterSettings.ShowApplicationLog = false;
|
||||
taskbarSettings.EnableTaskbar = true;
|
||||
taskbarSettings.ShowApplicationLog = false;
|
||||
context.Settings.ActionCenter.EnableActionCenter = true;
|
||||
context.Settings.ActionCenter.ShowApplicationLog = false;
|
||||
context.Settings.Taskbar.EnableTaskbar = true;
|
||||
context.Settings.Taskbar.ShowApplicationLog = false;
|
||||
|
||||
uiFactory
|
||||
.Setup(f => f.CreateNotificationControl(It.IsAny<INotificationController>(), It.Is<INotificationInfo>(i => i == logInfo.Object), It.IsAny<Location>()))
|
||||
|
@ -190,14 +189,14 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
|
|||
[TestMethod]
|
||||
public void Perform_MustInitializeSystemComponents()
|
||||
{
|
||||
actionCenterSettings.EnableActionCenter = true;
|
||||
actionCenterSettings.ShowAudio = true;
|
||||
actionCenterSettings.ShowKeyboardLayout = true;
|
||||
actionCenterSettings.ShowWirelessNetwork = true;
|
||||
taskbarSettings.EnableTaskbar = true;
|
||||
taskbarSettings.ShowAudio = true;
|
||||
taskbarSettings.ShowKeyboardLayout = true;
|
||||
taskbarSettings.ShowWirelessNetwork = true;
|
||||
context.Settings.ActionCenter.EnableActionCenter = true;
|
||||
context.Settings.ActionCenter.ShowAudio = true;
|
||||
context.Settings.ActionCenter.ShowKeyboardLayout = true;
|
||||
context.Settings.ActionCenter.ShowWirelessNetwork = true;
|
||||
context.Settings.Taskbar.EnableTaskbar = true;
|
||||
context.Settings.Taskbar.ShowAudio = true;
|
||||
context.Settings.Taskbar.ShowKeyboardLayout = true;
|
||||
context.Settings.Taskbar.ShowWirelessNetwork = true;
|
||||
|
||||
systemInfo.SetupGet(s => s.HasBattery).Returns(true);
|
||||
uiFactory.Setup(f => f.CreateAudioControl(It.IsAny<IAudio>(), It.IsAny<Location>())).Returns(new Mock<ISystemControl>().Object);
|
||||
|
@ -218,14 +217,14 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
|
|||
[TestMethod]
|
||||
public void Perform_MustNotInitializeSystemComponents()
|
||||
{
|
||||
actionCenterSettings.EnableActionCenter = true;
|
||||
actionCenterSettings.ShowAudio = false;
|
||||
actionCenterSettings.ShowKeyboardLayout = false;
|
||||
actionCenterSettings.ShowWirelessNetwork = false;
|
||||
taskbarSettings.EnableTaskbar = true;
|
||||
taskbarSettings.ShowAudio = false;
|
||||
taskbarSettings.ShowKeyboardLayout = false;
|
||||
taskbarSettings.ShowWirelessNetwork = false;
|
||||
context.Settings.ActionCenter.EnableActionCenter = true;
|
||||
context.Settings.ActionCenter.ShowAudio = false;
|
||||
context.Settings.ActionCenter.ShowKeyboardLayout = false;
|
||||
context.Settings.ActionCenter.ShowWirelessNetwork = false;
|
||||
context.Settings.Taskbar.EnableTaskbar = true;
|
||||
context.Settings.Taskbar.ShowAudio = false;
|
||||
context.Settings.Taskbar.ShowKeyboardLayout = false;
|
||||
context.Settings.Taskbar.ShowWirelessNetwork = false;
|
||||
|
||||
systemInfo.SetupGet(s => s.HasBattery).Returns(false);
|
||||
uiFactory.Setup(f => f.CreateAudioControl(It.IsAny<IAudio>(), It.IsAny<Location>())).Returns(new Mock<ISystemControl>().Object);
|
||||
|
@ -246,7 +245,7 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
|
|||
[TestMethod]
|
||||
public void Perform_MustNotInitializeActionCenterIfNotEnabled()
|
||||
{
|
||||
actionCenterSettings.EnableActionCenter = false;
|
||||
context.Settings.ActionCenter.EnableActionCenter = false;
|
||||
sut.Perform();
|
||||
actionCenter.VerifyNoOtherCalls();
|
||||
}
|
||||
|
@ -254,7 +253,7 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
|
|||
[TestMethod]
|
||||
public void Perform_MustNotInitializeTaskbarIfNotEnabled()
|
||||
{
|
||||
taskbarSettings.EnableTaskbar = false;
|
||||
context.Settings.Taskbar.EnableTaskbar = false;
|
||||
sut.Perform();
|
||||
taskbar.VerifyNoOtherCalls();
|
||||
}
|
||||
|
@ -269,7 +268,7 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
|
|||
new Mock<IActionCenterActivator>()
|
||||
};
|
||||
|
||||
actionCenterSettings.EnableActionCenter = true;
|
||||
context.Settings.ActionCenter.EnableActionCenter = true;
|
||||
|
||||
foreach (var activator in activatorMocks)
|
||||
{
|
||||
|
|
|
@ -6,13 +6,16 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using SafeExamBrowser.Browser.Contracts;
|
||||
using SafeExamBrowser.Communication.Contracts.Hosts;
|
||||
using SafeExamBrowser.Configuration.Contracts;
|
||||
using SafeExamBrowser.Settings;
|
||||
|
||||
namespace SafeExamBrowser.Client
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds all configuration and runtime data for the client.
|
||||
/// Holds all configuration and session data for the client.
|
||||
/// </summary>
|
||||
internal class ClientContext
|
||||
{
|
||||
|
@ -21,6 +24,21 @@ namespace SafeExamBrowser.Client
|
|||
/// </summary>
|
||||
internal AppConfig AppConfig { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The browser application.
|
||||
/// </summary>
|
||||
internal IBrowserApplication Browser { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The client communication host.
|
||||
/// </summary>
|
||||
internal IClientHost ClientHost { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The identifier of the current session.
|
||||
/// </summary>
|
||||
internal Guid SessionId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The settings for the current session.
|
||||
/// </summary>
|
||||
|
|
|
@ -15,7 +15,6 @@ using SafeExamBrowser.Communication.Contracts.Data;
|
|||
using SafeExamBrowser.Communication.Contracts.Events;
|
||||
using SafeExamBrowser.Communication.Contracts.Hosts;
|
||||
using SafeExamBrowser.Communication.Contracts.Proxies;
|
||||
using SafeExamBrowser.Configuration.Contracts;
|
||||
using SafeExamBrowser.Configuration.Contracts.Cryptography;
|
||||
using SafeExamBrowser.Core.Contracts.OperationModel;
|
||||
using SafeExamBrowser.Core.Contracts.OperationModel.Events;
|
||||
|
@ -36,6 +35,7 @@ namespace SafeExamBrowser.Client
|
|||
{
|
||||
private IActionCenter actionCenter;
|
||||
private IApplicationMonitor applicationMonitor;
|
||||
private ClientContext context;
|
||||
private IDisplayMonitor displayMonitor;
|
||||
private IExplorerShell explorerShell;
|
||||
private IHashAlgorithm hashAlgorithm;
|
||||
|
@ -49,29 +49,15 @@ namespace SafeExamBrowser.Client
|
|||
private ITerminationActivator terminationActivator;
|
||||
private IText text;
|
||||
private IUserInterfaceFactory uiFactory;
|
||||
private AppConfig appConfig;
|
||||
|
||||
public IBrowserApplication Browser { private get; set; }
|
||||
public IClientHost ClientHost { private get; set; }
|
||||
public Guid SessionId { private get; set; }
|
||||
public AppSettings Settings { private get; set; }
|
||||
|
||||
public AppConfig AppConfig
|
||||
{
|
||||
set
|
||||
{
|
||||
appConfig = value;
|
||||
|
||||
if (splashScreen != null)
|
||||
{
|
||||
splashScreen.AppConfig = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
private IBrowserApplication Browser => context.Browser;
|
||||
private IClientHost ClientHost => context.ClientHost;
|
||||
private AppSettings Settings => context.Settings;
|
||||
|
||||
public ClientController(
|
||||
IActionCenter actionCenter,
|
||||
IApplicationMonitor applicationMonitor,
|
||||
ClientContext context,
|
||||
IDisplayMonitor displayMonitor,
|
||||
IExplorerShell explorerShell,
|
||||
IHashAlgorithm hashAlgorithm,
|
||||
|
@ -87,6 +73,7 @@ namespace SafeExamBrowser.Client
|
|||
{
|
||||
this.actionCenter = actionCenter;
|
||||
this.applicationMonitor = applicationMonitor;
|
||||
this.context = context;
|
||||
this.displayMonitor = displayMonitor;
|
||||
this.explorerShell = explorerShell;
|
||||
this.hashAlgorithm = hashAlgorithm;
|
||||
|
@ -147,7 +134,7 @@ namespace SafeExamBrowser.Client
|
|||
logger.Log(string.Empty);
|
||||
logger.Info("Initiating shutdown procedure...");
|
||||
|
||||
splashScreen = uiFactory.CreateSplashScreen(appConfig);
|
||||
splashScreen = uiFactory.CreateSplashScreen(context.AppConfig);
|
||||
actionCenter.Close();
|
||||
taskbar.Close();
|
||||
|
||||
|
@ -169,6 +156,14 @@ namespace SafeExamBrowser.Client
|
|||
splashScreen.Close();
|
||||
}
|
||||
|
||||
public void UpdateAppConfig()
|
||||
{
|
||||
if (splashScreen != null)
|
||||
{
|
||||
splashScreen.AppConfig = context.AppConfig;
|
||||
}
|
||||
}
|
||||
|
||||
private void RegisterEvents()
|
||||
{
|
||||
actionCenter.QuitButtonClicked += Shell_QuitButtonClicked;
|
||||
|
@ -239,7 +234,7 @@ namespace SafeExamBrowser.Client
|
|||
{
|
||||
args.AllowDownload = true;
|
||||
args.Callback = Browser_ConfigurationDownloadFinished;
|
||||
args.DownloadPath = Path.Combine(appConfig.DownloadDirectory, fileName);
|
||||
args.DownloadPath = Path.Combine(context.AppConfig.DownloadDirectory, fileName);
|
||||
logger.Info($"Allowed download request for configuration file '{fileName}'.");
|
||||
}
|
||||
else
|
||||
|
@ -259,7 +254,7 @@ namespace SafeExamBrowser.Client
|
|||
{
|
||||
logger.Info($"Sent reconfiguration request for '{filePath}' to the runtime.");
|
||||
|
||||
splashScreen = uiFactory.CreateSplashScreen(appConfig);
|
||||
splashScreen = uiFactory.CreateSplashScreen(context.AppConfig);
|
||||
splashScreen.SetIndeterminate();
|
||||
splashScreen.UpdateStatus(TextKey.OperationStatus_InitializeSession, true);
|
||||
splashScreen.Show();
|
||||
|
|
|
@ -12,17 +12,14 @@ using System.Diagnostics;
|
|||
using System.IO;
|
||||
using System.Reflection;
|
||||
using SafeExamBrowser.Browser;
|
||||
using SafeExamBrowser.Browser.Contracts;
|
||||
using SafeExamBrowser.Client.Communication;
|
||||
using SafeExamBrowser.Client.Contracts;
|
||||
using SafeExamBrowser.Client.Notifications;
|
||||
using SafeExamBrowser.Client.Operations;
|
||||
using SafeExamBrowser.Communication.Contracts;
|
||||
using SafeExamBrowser.Communication.Contracts.Hosts;
|
||||
using SafeExamBrowser.Communication.Contracts.Proxies;
|
||||
using SafeExamBrowser.Communication.Hosts;
|
||||
using SafeExamBrowser.Communication.Proxies;
|
||||
using SafeExamBrowser.Configuration.Contracts;
|
||||
using SafeExamBrowser.Configuration.Cryptography;
|
||||
using SafeExamBrowser.Core.Contracts.OperationModel;
|
||||
using SafeExamBrowser.Core.OperationModel;
|
||||
|
@ -56,8 +53,9 @@ namespace SafeExamBrowser.Client
|
|||
{
|
||||
internal class CompositionRoot
|
||||
{
|
||||
private const int FIVE_SECONDS = 5000;
|
||||
|
||||
private Guid authenticationToken;
|
||||
private ClientConfiguration configuration;
|
||||
private ClientContext context;
|
||||
private string logFilePath;
|
||||
private LogLevel logLevel;
|
||||
|
@ -66,8 +64,6 @@ namespace SafeExamBrowser.Client
|
|||
|
||||
private IActionCenter actionCenter;
|
||||
private IApplicationMonitor applicationMonitor;
|
||||
private IBrowserApplication browser;
|
||||
private IClientHost clientHost;
|
||||
private ILogger logger;
|
||||
private IMessageBox messageBox;
|
||||
private INativeMethods nativeMethods;
|
||||
|
@ -85,7 +81,6 @@ namespace SafeExamBrowser.Client
|
|||
{
|
||||
ValidateCommandLineArguments();
|
||||
|
||||
configuration = new ClientConfiguration();
|
||||
logger = new Logger();
|
||||
nativeMethods = new NativeMethods();
|
||||
systemInfo = new SystemInfo();
|
||||
|
@ -109,25 +104,25 @@ namespace SafeExamBrowser.Client
|
|||
var operations = new Queue<IOperation>();
|
||||
|
||||
operations.Enqueue(new I18nOperation(logger, text, textResource));
|
||||
operations.Enqueue(new RuntimeConnectionOperation(logger, runtimeProxy, authenticationToken));
|
||||
operations.Enqueue(new ConfigurationOperation(configuration, context, logger, runtimeProxy));
|
||||
operations.Enqueue(new RuntimeConnectionOperation(context, logger, runtimeProxy, authenticationToken));
|
||||
operations.Enqueue(new ConfigurationOperation(context, logger, runtimeProxy));
|
||||
operations.Enqueue(new DelegateOperation(UpdateAppConfig));
|
||||
operations.Enqueue(new LazyInitializationOperation(BuildClientHostOperation));
|
||||
operations.Enqueue(new LazyInitializationOperation(BuildClientHostDisconnectionOperation));
|
||||
operations.Enqueue(new ClientHostDisconnectionOperation(context, logger, FIVE_SECONDS));
|
||||
operations.Enqueue(new LazyInitializationOperation(BuildKeyboardInterceptorOperation));
|
||||
operations.Enqueue(new LazyInitializationOperation(BuildMouseInterceptorOperation));
|
||||
operations.Enqueue(new LazyInitializationOperation(BuildApplicationOperation));
|
||||
operations.Enqueue(new DisplayMonitorOperation(displayMonitor, logger, taskbar));
|
||||
operations.Enqueue(new ApplicationOperation(applicationMonitor, context, logger));
|
||||
operations.Enqueue(new DisplayMonitorOperation(context, displayMonitor, logger, taskbar));
|
||||
operations.Enqueue(new LazyInitializationOperation(BuildShellOperation));
|
||||
operations.Enqueue(new LazyInitializationOperation(BuildBrowserOperation));
|
||||
operations.Enqueue(new ClipboardOperation(logger, nativeMethods));
|
||||
operations.Enqueue(new DelegateOperation(UpdateClientControllerDependencies));
|
||||
operations.Enqueue(new ClipboardOperation(context, logger, nativeMethods));
|
||||
|
||||
var sequence = new OperationSequence(logger, operations);
|
||||
|
||||
ClientController = new ClientController(
|
||||
actionCenter,
|
||||
applicationMonitor,
|
||||
context,
|
||||
displayMonitor,
|
||||
explorerShell,
|
||||
hashAlgorithm,
|
||||
|
@ -198,57 +193,43 @@ namespace SafeExamBrowser.Client
|
|||
textResource = new XmlTextResource(path);
|
||||
}
|
||||
|
||||
private IOperation BuildApplicationOperation()
|
||||
{
|
||||
return new ApplicationOperation(applicationMonitor, context, logger);
|
||||
}
|
||||
|
||||
private IOperation BuildBrowserOperation()
|
||||
{
|
||||
var moduleLogger = new ModuleLogger(logger, nameof(BrowserApplication));
|
||||
var browser = new BrowserApplication(configuration.AppConfig, configuration.Settings.Browser, messageBox, moduleLogger, text, uiFactory);
|
||||
var browser = new BrowserApplication(context.AppConfig, context.Settings.Browser, messageBox, moduleLogger, text, uiFactory);
|
||||
var browserInfo = new BrowserApplicationInfo();
|
||||
var operation = new BrowserOperation(actionCenter, browser, logger, taskbar, uiFactory);
|
||||
var operation = new BrowserOperation(actionCenter, context, logger, taskbar, uiFactory);
|
||||
|
||||
this.browser = browser;
|
||||
context.Browser = browser;
|
||||
|
||||
return operation;
|
||||
}
|
||||
|
||||
private IOperation BuildClientHostOperation()
|
||||
{
|
||||
const int FIVE_SECONDS = 5000;
|
||||
var processId = Process.GetCurrentProcess().Id;
|
||||
var factory = new HostObjectFactory();
|
||||
var host = new ClientHost(configuration.AppConfig.ClientAddress, factory, new ModuleLogger(logger, nameof(ClientHost)), processId, FIVE_SECONDS);
|
||||
var operation = new CommunicationHostOperation(host, logger);
|
||||
var clientHost = new ClientHost(context.AppConfig.ClientAddress, factory, new ModuleLogger(logger, nameof(ClientHost)), processId, FIVE_SECONDS);
|
||||
var operation = new CommunicationHostOperation(clientHost, logger);
|
||||
|
||||
clientHost = host;
|
||||
clientHost.AuthenticationToken = authenticationToken;
|
||||
|
||||
return operation;
|
||||
}
|
||||
|
||||
private IOperation BuildClientHostDisconnectionOperation()
|
||||
{
|
||||
var timeout_ms = 5000;
|
||||
var operation = new ClientHostDisconnectionOperation(clientHost, logger, timeout_ms);
|
||||
context.ClientHost = clientHost;
|
||||
context.ClientHost.AuthenticationToken = authenticationToken;
|
||||
|
||||
return operation;
|
||||
}
|
||||
|
||||
private IOperation BuildKeyboardInterceptorOperation()
|
||||
{
|
||||
var keyboardInterceptor = new KeyboardInterceptor(configuration.Settings.Keyboard, new ModuleLogger(logger, nameof(KeyboardInterceptor)), nativeMethods);
|
||||
var operation = new KeyboardInterceptorOperation(keyboardInterceptor, logger);
|
||||
var keyboardInterceptor = new KeyboardInterceptor(new ModuleLogger(logger, nameof(KeyboardInterceptor)), nativeMethods, context.Settings.Keyboard);
|
||||
var operation = new KeyboardInterceptorOperation(context, keyboardInterceptor, logger);
|
||||
|
||||
return operation;
|
||||
}
|
||||
|
||||
private IOperation BuildMouseInterceptorOperation()
|
||||
{
|
||||
var mouseInterceptor = new MouseInterceptor(new ModuleLogger(logger, nameof(MouseInterceptor)), configuration.Settings.Mouse, nativeMethods);
|
||||
var operation = new MouseInterceptorOperation(logger, mouseInterceptor);
|
||||
var mouseInterceptor = new MouseInterceptor(new ModuleLogger(logger, nameof(MouseInterceptor)), nativeMethods, context.Settings.Mouse);
|
||||
var operation = new MouseInterceptorOperation(context, logger, mouseInterceptor);
|
||||
|
||||
return operation;
|
||||
}
|
||||
|
@ -256,8 +237,8 @@ namespace SafeExamBrowser.Client
|
|||
private IOperation BuildShellOperation()
|
||||
{
|
||||
var aboutInfo = new AboutNotificationInfo(text);
|
||||
var aboutController = new AboutNotificationController(configuration.AppConfig, uiFactory);
|
||||
var audio = new Audio(configuration.Settings.Audio, new ModuleLogger(logger, nameof(Audio)));
|
||||
var aboutController = new AboutNotificationController(context.AppConfig, uiFactory);
|
||||
var audio = new Audio(context.Settings.Audio, new ModuleLogger(logger, nameof(Audio)));
|
||||
var keyboard = new Keyboard(new ModuleLogger(logger, nameof(Keyboard)));
|
||||
var logInfo = new LogNotificationInfo(text);
|
||||
var logController = new LogNotificationController(logger, uiFactory);
|
||||
|
@ -271,10 +252,10 @@ namespace SafeExamBrowser.Client
|
|||
var operation = new ShellOperation(
|
||||
actionCenter,
|
||||
activators,
|
||||
configuration.Settings.ActionCenter,
|
||||
audio,
|
||||
aboutInfo,
|
||||
aboutController,
|
||||
context,
|
||||
keyboard,
|
||||
logger,
|
||||
logInfo,
|
||||
|
@ -282,7 +263,6 @@ namespace SafeExamBrowser.Client
|
|||
powerSupply,
|
||||
systemInfo,
|
||||
taskbar,
|
||||
configuration.Settings.Taskbar,
|
||||
terminationActivator,
|
||||
text,
|
||||
uiFactory,
|
||||
|
@ -337,15 +317,7 @@ namespace SafeExamBrowser.Client
|
|||
|
||||
private void UpdateAppConfig()
|
||||
{
|
||||
ClientController.AppConfig = configuration.AppConfig;
|
||||
}
|
||||
|
||||
private void UpdateClientControllerDependencies()
|
||||
{
|
||||
ClientController.Browser = browser;
|
||||
ClientController.ClientHost = clientHost;
|
||||
ClientController.SessionId = configuration.SessionId;
|
||||
ClientController.Settings = configuration.Settings;
|
||||
ClientController.UpdateAppConfig();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
using SafeExamBrowser.Applications.Contracts;
|
||||
using SafeExamBrowser.Core.Contracts.OperationModel;
|
||||
using SafeExamBrowser.Core.Contracts.OperationModel.Events;
|
||||
using SafeExamBrowser.I18n.Contracts;
|
||||
|
@ -16,50 +15,48 @@ using SafeExamBrowser.UserInterface.Contracts.Shell;
|
|||
|
||||
namespace SafeExamBrowser.Client.Operations
|
||||
{
|
||||
internal class BrowserOperation : IOperation
|
||||
internal class BrowserOperation : ClientOperation
|
||||
{
|
||||
private IActionCenter actionCenter;
|
||||
private IApplication browser;
|
||||
private ILogger logger;
|
||||
private ITaskbar taskbar;
|
||||
private IUserInterfaceFactory uiFactory;
|
||||
|
||||
public event ActionRequiredEventHandler ActionRequired { add { } remove { } }
|
||||
public event StatusChangedEventHandler StatusChanged;
|
||||
public override event ActionRequiredEventHandler ActionRequired { add { } remove { } }
|
||||
public override event StatusChangedEventHandler StatusChanged;
|
||||
|
||||
public BrowserOperation(
|
||||
IActionCenter actionCenter,
|
||||
IApplication browser,
|
||||
ClientContext context,
|
||||
ILogger logger,
|
||||
ITaskbar taskbar,
|
||||
IUserInterfaceFactory uiFactory)
|
||||
IUserInterfaceFactory uiFactory) : base(context)
|
||||
{
|
||||
this.actionCenter = actionCenter;
|
||||
this.browser = browser;
|
||||
this.logger = logger;
|
||||
this.taskbar = taskbar;
|
||||
this.uiFactory = uiFactory;
|
||||
}
|
||||
|
||||
public OperationResult Perform()
|
||||
public override OperationResult Perform()
|
||||
{
|
||||
logger.Info("Initializing browser...");
|
||||
StatusChanged?.Invoke(TextKey.OperationStatus_InitializeBrowser);
|
||||
|
||||
browser.Initialize();
|
||||
Context.Browser.Initialize();
|
||||
|
||||
actionCenter.AddApplicationControl(uiFactory.CreateApplicationControl(browser, Location.ActionCenter));
|
||||
taskbar.AddApplicationControl(uiFactory.CreateApplicationControl(browser, Location.Taskbar));
|
||||
actionCenter.AddApplicationControl(uiFactory.CreateApplicationControl(Context.Browser, Location.ActionCenter));
|
||||
taskbar.AddApplicationControl(uiFactory.CreateApplicationControl(Context.Browser, Location.Taskbar));
|
||||
|
||||
return OperationResult.Success;
|
||||
}
|
||||
|
||||
public OperationResult Revert()
|
||||
public override OperationResult Revert()
|
||||
{
|
||||
logger.Info("Terminating browser...");
|
||||
StatusChanged?.Invoke(TextKey.OperationStatus_TerminateBrowser);
|
||||
|
||||
browser.Terminate();
|
||||
Context.Browser.Terminate();
|
||||
|
||||
return OperationResult.Success;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
using System.Threading;
|
||||
using SafeExamBrowser.Communication.Contracts.Events;
|
||||
using SafeExamBrowser.Communication.Contracts.Hosts;
|
||||
using SafeExamBrowser.Core.Contracts.OperationModel;
|
||||
using SafeExamBrowser.Core.Contracts.OperationModel.Events;
|
||||
using SafeExamBrowser.I18n.Contracts;
|
||||
|
@ -20,43 +19,41 @@ namespace SafeExamBrowser.Client.Operations
|
|||
/// During application shutdown, it could happen that the client stops its communication host before the runtime had the chance to
|
||||
/// disconnect from it. This operation prevents the described race condition by waiting on the runtime to disconnect from the client.
|
||||
/// </summary>
|
||||
internal class ClientHostDisconnectionOperation : IOperation
|
||||
internal class ClientHostDisconnectionOperation : ClientOperation
|
||||
{
|
||||
private IClientHost clientHost;
|
||||
private ILogger logger;
|
||||
private int timeout_ms;
|
||||
|
||||
public event ActionRequiredEventHandler ActionRequired { add { } remove { } }
|
||||
public event StatusChangedEventHandler StatusChanged;
|
||||
public override event ActionRequiredEventHandler ActionRequired { add { } remove { } }
|
||||
public override event StatusChangedEventHandler StatusChanged;
|
||||
|
||||
public ClientHostDisconnectionOperation(IClientHost clientHost, ILogger logger, int timeout_ms)
|
||||
public ClientHostDisconnectionOperation(ClientContext context, ILogger logger, int timeout_ms) : base(context)
|
||||
{
|
||||
this.clientHost = clientHost;
|
||||
this.logger = logger;
|
||||
this.timeout_ms = timeout_ms;
|
||||
}
|
||||
|
||||
public OperationResult Perform()
|
||||
public override OperationResult Perform()
|
||||
{
|
||||
return OperationResult.Success;
|
||||
}
|
||||
|
||||
public OperationResult Revert()
|
||||
public override OperationResult Revert()
|
||||
{
|
||||
StatusChanged?.Invoke(TextKey.OperationStatus_WaitRuntimeDisconnection);
|
||||
|
||||
if (clientHost.IsConnected)
|
||||
if (Context.ClientHost.IsConnected)
|
||||
{
|
||||
var disconnected = false;
|
||||
var disconnectedEvent = new AutoResetEvent(false);
|
||||
var disconnectedEventHandler = new CommunicationEventHandler(() => disconnectedEvent.Set());
|
||||
|
||||
clientHost.RuntimeDisconnected += disconnectedEventHandler;
|
||||
Context.ClientHost.RuntimeDisconnected += disconnectedEventHandler;
|
||||
|
||||
logger.Info("Waiting for runtime to disconnect from client communication host...");
|
||||
disconnected = disconnectedEvent.WaitOne(timeout_ms);
|
||||
|
||||
clientHost.RuntimeDisconnected -= disconnectedEventHandler;
|
||||
Context.ClientHost.RuntimeDisconnected -= disconnectedEventHandler;
|
||||
|
||||
if (disconnected)
|
||||
{
|
||||
|
|
|
@ -14,28 +14,28 @@ using SafeExamBrowser.WindowsApi.Contracts;
|
|||
|
||||
namespace SafeExamBrowser.Client.Operations
|
||||
{
|
||||
internal class ClipboardOperation : IOperation
|
||||
internal class ClipboardOperation : ClientOperation
|
||||
{
|
||||
private ILogger logger;
|
||||
private INativeMethods nativeMethods;
|
||||
|
||||
public event ActionRequiredEventHandler ActionRequired { add { } remove { } }
|
||||
public event StatusChangedEventHandler StatusChanged;
|
||||
public override event ActionRequiredEventHandler ActionRequired { add { } remove { } }
|
||||
public override event StatusChangedEventHandler StatusChanged;
|
||||
|
||||
public ClipboardOperation(ILogger logger, INativeMethods nativeMethods)
|
||||
public ClipboardOperation(ClientContext context, ILogger logger, INativeMethods nativeMethods) : base(context)
|
||||
{
|
||||
this.logger = logger;
|
||||
this.nativeMethods = nativeMethods;
|
||||
}
|
||||
|
||||
public OperationResult Perform()
|
||||
public override OperationResult Perform()
|
||||
{
|
||||
EmptyClipboard();
|
||||
|
||||
return OperationResult.Success;
|
||||
}
|
||||
|
||||
public OperationResult Revert()
|
||||
public override OperationResult Revert()
|
||||
{
|
||||
EmptyClipboard();
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
*/
|
||||
|
||||
using SafeExamBrowser.Communication.Contracts.Proxies;
|
||||
using SafeExamBrowser.Configuration.Contracts;
|
||||
using SafeExamBrowser.Core.Contracts.OperationModel;
|
||||
using SafeExamBrowser.Core.Contracts.OperationModel.Events;
|
||||
using SafeExamBrowser.I18n.Contracts;
|
||||
|
@ -17,17 +16,14 @@ namespace SafeExamBrowser.Client.Operations
|
|||
{
|
||||
internal class ConfigurationOperation : ClientOperation
|
||||
{
|
||||
private ClientConfiguration configuration;
|
||||
private ILogger logger;
|
||||
private IRuntimeProxy runtime;
|
||||
|
||||
public override event ActionRequiredEventHandler ActionRequired { add { } remove { } }
|
||||
public override event StatusChangedEventHandler StatusChanged;
|
||||
|
||||
// TODO: Remove and delete ClientConfiguration!
|
||||
public ConfigurationOperation(ClientConfiguration configuration, ClientContext context, ILogger logger, IRuntimeProxy runtime) : base(context)
|
||||
public ConfigurationOperation(ClientContext context, ILogger logger, IRuntimeProxy runtime) : base(context)
|
||||
{
|
||||
this.configuration = configuration;
|
||||
this.logger = logger;
|
||||
this.runtime = runtime;
|
||||
}
|
||||
|
@ -38,19 +34,16 @@ namespace SafeExamBrowser.Client.Operations
|
|||
StatusChanged?.Invoke(TextKey.OperationStatus_InitializeConfiguration);
|
||||
|
||||
var communication = runtime.GetConfiguration();
|
||||
var config = communication.Value.Configuration;
|
||||
var configuration = communication.Value.Configuration;
|
||||
|
||||
configuration.AppConfig = config.AppConfig;
|
||||
configuration.SessionId = config.SessionId;
|
||||
configuration.Settings = config.Settings;
|
||||
|
||||
Context.AppConfig = config.AppConfig;
|
||||
Context.Settings = config.Settings;
|
||||
Context.AppConfig = configuration.AppConfig;
|
||||
Context.SessionId = configuration.SessionId;
|
||||
Context.Settings = configuration.Settings;
|
||||
|
||||
logger.Info("Successfully retrieved the application configuration from the runtime.");
|
||||
logger.Info($" -> Client-ID: {configuration.AppConfig.ClientId}");
|
||||
logger.Info($" -> Runtime-ID: {configuration.AppConfig.RuntimeId}");
|
||||
logger.Info($" -> Session-ID: {configuration.SessionId}");
|
||||
logger.Info($" -> Client-ID: {Context.AppConfig.ClientId}");
|
||||
logger.Info($" -> Runtime-ID: {Context.AppConfig.RuntimeId}");
|
||||
logger.Info($" -> Session-ID: {Context.SessionId}");
|
||||
|
||||
return OperationResult.Success;
|
||||
}
|
||||
|
|
|
@ -15,23 +15,23 @@ using SafeExamBrowser.UserInterface.Contracts.Shell;
|
|||
|
||||
namespace SafeExamBrowser.Client.Operations
|
||||
{
|
||||
internal class DisplayMonitorOperation : IOperation
|
||||
internal class DisplayMonitorOperation : ClientOperation
|
||||
{
|
||||
private IDisplayMonitor displayMonitor;
|
||||
private ILogger logger;
|
||||
private ITaskbar taskbar;
|
||||
|
||||
public event ActionRequiredEventHandler ActionRequired { add { } remove { } }
|
||||
public event StatusChangedEventHandler StatusChanged;
|
||||
public override event ActionRequiredEventHandler ActionRequired { add { } remove { } }
|
||||
public override event StatusChangedEventHandler StatusChanged;
|
||||
|
||||
public DisplayMonitorOperation(IDisplayMonitor displayMonitor, ILogger logger, ITaskbar taskbar)
|
||||
public DisplayMonitorOperation(ClientContext context, IDisplayMonitor displayMonitor, ILogger logger, ITaskbar taskbar) : base(context)
|
||||
{
|
||||
this.displayMonitor = displayMonitor;
|
||||
this.logger = logger;
|
||||
this.taskbar = taskbar;
|
||||
}
|
||||
|
||||
public OperationResult Perform()
|
||||
public override OperationResult Perform()
|
||||
{
|
||||
logger.Info("Initializing working area...");
|
||||
StatusChanged?.Invoke(TextKey.OperationStatus_InitializeWorkingArea);
|
||||
|
@ -43,7 +43,7 @@ namespace SafeExamBrowser.Client.Operations
|
|||
return OperationResult.Success;
|
||||
}
|
||||
|
||||
public OperationResult Revert()
|
||||
public override OperationResult Revert()
|
||||
{
|
||||
logger.Info("Restoring working area...");
|
||||
StatusChanged?.Invoke(TextKey.OperationStatus_RestoreWorkingArea);
|
||||
|
|
|
@ -14,21 +14,21 @@ using SafeExamBrowser.Monitoring.Contracts.Keyboard;
|
|||
|
||||
namespace SafeExamBrowser.Client.Operations
|
||||
{
|
||||
internal class KeyboardInterceptorOperation : IOperation
|
||||
internal class KeyboardInterceptorOperation : ClientOperation
|
||||
{
|
||||
private IKeyboardInterceptor keyboardInterceptor;
|
||||
private ILogger logger;
|
||||
|
||||
public event ActionRequiredEventHandler ActionRequired { add { } remove { } }
|
||||
public event StatusChangedEventHandler StatusChanged;
|
||||
public override event ActionRequiredEventHandler ActionRequired { add { } remove { } }
|
||||
public override event StatusChangedEventHandler StatusChanged;
|
||||
|
||||
public KeyboardInterceptorOperation(IKeyboardInterceptor keyboardInterceptor, ILogger logger)
|
||||
public KeyboardInterceptorOperation(ClientContext context, IKeyboardInterceptor keyboardInterceptor, ILogger logger) : base(context)
|
||||
{
|
||||
this.keyboardInterceptor = keyboardInterceptor;
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
public OperationResult Perform()
|
||||
public override OperationResult Perform()
|
||||
{
|
||||
logger.Info("Starting keyboard interception...");
|
||||
StatusChanged?.Invoke(TextKey.OperationStatus_StartKeyboardInterception);
|
||||
|
@ -38,7 +38,7 @@ namespace SafeExamBrowser.Client.Operations
|
|||
return OperationResult.Success;
|
||||
}
|
||||
|
||||
public OperationResult Revert()
|
||||
public override OperationResult Revert()
|
||||
{
|
||||
logger.Info("Stopping keyboard interception...");
|
||||
StatusChanged?.Invoke(TextKey.OperationStatus_StopKeyboardInterception);
|
||||
|
|
|
@ -14,21 +14,21 @@ using SafeExamBrowser.Monitoring.Contracts.Mouse;
|
|||
|
||||
namespace SafeExamBrowser.Client.Operations
|
||||
{
|
||||
internal class MouseInterceptorOperation : IOperation
|
||||
internal class MouseInterceptorOperation : ClientOperation
|
||||
{
|
||||
private ILogger logger;
|
||||
private IMouseInterceptor mouseInterceptor;
|
||||
|
||||
public event ActionRequiredEventHandler ActionRequired { add { } remove { } }
|
||||
public event StatusChangedEventHandler StatusChanged;
|
||||
public override event ActionRequiredEventHandler ActionRequired { add { } remove { } }
|
||||
public override event StatusChangedEventHandler StatusChanged;
|
||||
|
||||
public MouseInterceptorOperation(ILogger logger, IMouseInterceptor mouseInterceptor)
|
||||
public MouseInterceptorOperation(ClientContext context, ILogger logger, IMouseInterceptor mouseInterceptor) : base(context)
|
||||
{
|
||||
this.logger = logger;
|
||||
this.mouseInterceptor = mouseInterceptor;
|
||||
}
|
||||
|
||||
public OperationResult Perform()
|
||||
public override OperationResult Perform()
|
||||
{
|
||||
logger.Info("Starting mouse interception...");
|
||||
StatusChanged?.Invoke(TextKey.OperationStatus_StartMouseInterception);
|
||||
|
@ -38,7 +38,7 @@ namespace SafeExamBrowser.Client.Operations
|
|||
return OperationResult.Success;
|
||||
}
|
||||
|
||||
public OperationResult Revert()
|
||||
public override OperationResult Revert()
|
||||
{
|
||||
logger.Info("Stopping mouse interception...");
|
||||
StatusChanged?.Invoke(TextKey.OperationStatus_StopMouseInterception);
|
||||
|
|
|
@ -15,23 +15,23 @@ using SafeExamBrowser.Logging.Contracts;
|
|||
|
||||
namespace SafeExamBrowser.Client.Operations
|
||||
{
|
||||
internal class RuntimeConnectionOperation : IOperation
|
||||
internal class RuntimeConnectionOperation : ClientOperation
|
||||
{
|
||||
private ILogger logger;
|
||||
private IRuntimeProxy runtime;
|
||||
private Guid token;
|
||||
|
||||
public event ActionRequiredEventHandler ActionRequired { add { } remove { } }
|
||||
public event StatusChangedEventHandler StatusChanged;
|
||||
public override event ActionRequiredEventHandler ActionRequired { add { } remove { } }
|
||||
public override event StatusChangedEventHandler StatusChanged;
|
||||
|
||||
public RuntimeConnectionOperation(ILogger logger, IRuntimeProxy runtime, Guid token)
|
||||
public RuntimeConnectionOperation(ClientContext context, ILogger logger, IRuntimeProxy runtime, Guid token) : base(context)
|
||||
{
|
||||
this.logger = logger;
|
||||
this.runtime = runtime;
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
public OperationResult Perform()
|
||||
public override OperationResult Perform()
|
||||
{
|
||||
logger.Info("Initializing runtime connection...");
|
||||
StatusChanged?.Invoke(TextKey.OperationStatus_InitializeRuntimeConnection);
|
||||
|
@ -50,7 +50,7 @@ namespace SafeExamBrowser.Client.Operations
|
|||
return connected ? OperationResult.Success : OperationResult.Failed;
|
||||
}
|
||||
|
||||
public OperationResult Revert()
|
||||
public override OperationResult Revert()
|
||||
{
|
||||
logger.Info("Closing runtime connection...");
|
||||
StatusChanged?.Invoke(TextKey.OperationStatus_CloseRuntimeConnection);
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
using System.Collections.Generic;
|
||||
using SafeExamBrowser.Client.Contracts;
|
||||
using SafeExamBrowser.Settings.UserInterface;
|
||||
using SafeExamBrowser.Core.Contracts.OperationModel;
|
||||
using SafeExamBrowser.Core.Contracts.OperationModel.Events;
|
||||
using SafeExamBrowser.I18n.Contracts;
|
||||
|
@ -24,11 +23,10 @@ using SafeExamBrowser.WindowsApi.Contracts;
|
|||
|
||||
namespace SafeExamBrowser.Client.Operations
|
||||
{
|
||||
internal class ShellOperation : IOperation
|
||||
internal class ShellOperation : ClientOperation
|
||||
{
|
||||
private IActionCenter actionCenter;
|
||||
private IEnumerable<IActionCenterActivator> activators;
|
||||
private ActionCenterSettings actionCenterSettings;
|
||||
private IAudio audio;
|
||||
private INotificationInfo aboutInfo;
|
||||
private INotificationController aboutController;
|
||||
|
@ -39,22 +37,21 @@ namespace SafeExamBrowser.Client.Operations
|
|||
private IPowerSupply powerSupply;
|
||||
private ISystemInfo systemInfo;
|
||||
private ITaskbar taskbar;
|
||||
private TaskbarSettings taskbarSettings;
|
||||
private ITerminationActivator terminationActivator;
|
||||
private IText text;
|
||||
private IUserInterfaceFactory uiFactory;
|
||||
private IWirelessAdapter wirelessAdapter;
|
||||
|
||||
public event ActionRequiredEventHandler ActionRequired { add { } remove { } }
|
||||
public event StatusChangedEventHandler StatusChanged;
|
||||
public override event ActionRequiredEventHandler ActionRequired { add { } remove { } }
|
||||
public override event StatusChangedEventHandler StatusChanged;
|
||||
|
||||
public ShellOperation(
|
||||
IActionCenter actionCenter,
|
||||
IEnumerable<IActionCenterActivator> activators,
|
||||
ActionCenterSettings actionCenterSettings,
|
||||
IAudio audio,
|
||||
INotificationInfo aboutInfo,
|
||||
INotificationController aboutController,
|
||||
ClientContext context,
|
||||
IKeyboard keyboard,
|
||||
ILogger logger,
|
||||
INotificationInfo logInfo,
|
||||
|
@ -62,17 +59,15 @@ namespace SafeExamBrowser.Client.Operations
|
|||
IPowerSupply powerSupply,
|
||||
ISystemInfo systemInfo,
|
||||
ITaskbar taskbar,
|
||||
TaskbarSettings taskbarSettings,
|
||||
ITerminationActivator terminationActivator,
|
||||
IText text,
|
||||
IUserInterfaceFactory uiFactory,
|
||||
IWirelessAdapter wirelessAdapter)
|
||||
IWirelessAdapter wirelessAdapter) : base(context)
|
||||
{
|
||||
this.aboutInfo = aboutInfo;
|
||||
this.aboutController = aboutController;
|
||||
this.actionCenter = actionCenter;
|
||||
this.activators = activators;
|
||||
this.actionCenterSettings = actionCenterSettings;
|
||||
this.audio = audio;
|
||||
this.keyboard = keyboard;
|
||||
this.logger = logger;
|
||||
|
@ -80,7 +75,6 @@ namespace SafeExamBrowser.Client.Operations
|
|||
this.logController = logController;
|
||||
this.powerSupply = powerSupply;
|
||||
this.systemInfo = systemInfo;
|
||||
this.taskbarSettings = taskbarSettings;
|
||||
this.terminationActivator = terminationActivator;
|
||||
this.text = text;
|
||||
this.taskbar = taskbar;
|
||||
|
@ -88,7 +82,7 @@ namespace SafeExamBrowser.Client.Operations
|
|||
this.wirelessAdapter = wirelessAdapter;
|
||||
}
|
||||
|
||||
public OperationResult Perform()
|
||||
public override OperationResult Perform()
|
||||
{
|
||||
logger.Info("Initializing shell...");
|
||||
StatusChanged?.Invoke(TextKey.OperationStatus_InitializeShell);
|
||||
|
@ -101,7 +95,7 @@ namespace SafeExamBrowser.Client.Operations
|
|||
return OperationResult.Success;
|
||||
}
|
||||
|
||||
public OperationResult Revert()
|
||||
public override OperationResult Revert()
|
||||
{
|
||||
logger.Info("Terminating shell...");
|
||||
StatusChanged?.Invoke(TextKey.OperationStatus_TerminateShell);
|
||||
|
@ -117,7 +111,7 @@ namespace SafeExamBrowser.Client.Operations
|
|||
{
|
||||
terminationActivator.Start();
|
||||
|
||||
if (actionCenterSettings.EnableActionCenter)
|
||||
if (Context.Settings.ActionCenter.EnableActionCenter)
|
||||
{
|
||||
foreach (var activator in activators)
|
||||
{
|
||||
|
@ -129,7 +123,7 @@ namespace SafeExamBrowser.Client.Operations
|
|||
|
||||
private void InitializeActionCenter()
|
||||
{
|
||||
if (actionCenterSettings.EnableActionCenter)
|
||||
if (Context.Settings.ActionCenter.EnableActionCenter)
|
||||
{
|
||||
logger.Info("Initializing action center...");
|
||||
actionCenter.InitializeText(text);
|
||||
|
@ -150,7 +144,7 @@ namespace SafeExamBrowser.Client.Operations
|
|||
|
||||
private void InitializeTaskbar()
|
||||
{
|
||||
if (taskbarSettings.EnableTaskbar)
|
||||
if (Context.Settings.Taskbar.EnableTaskbar)
|
||||
{
|
||||
logger.Info("Initializing taskbar...");
|
||||
taskbar.InitializeText(text);
|
||||
|
@ -179,7 +173,7 @@ namespace SafeExamBrowser.Client.Operations
|
|||
|
||||
private void InitializeAboutNotificationForActionCenter()
|
||||
{
|
||||
if (actionCenterSettings.ShowApplicationInfo)
|
||||
if (Context.Settings.ActionCenter.ShowApplicationInfo)
|
||||
{
|
||||
actionCenter.AddNotificationControl(uiFactory.CreateNotificationControl(aboutController, aboutInfo, Location.ActionCenter));
|
||||
}
|
||||
|
@ -187,7 +181,7 @@ namespace SafeExamBrowser.Client.Operations
|
|||
|
||||
private void InitializeAboutNotificationForTaskbar()
|
||||
{
|
||||
if (taskbarSettings.ShowApplicationInfo)
|
||||
if (Context.Settings.Taskbar.ShowApplicationInfo)
|
||||
{
|
||||
taskbar.AddNotificationControl(uiFactory.CreateNotificationControl(aboutController, aboutInfo, Location.Taskbar));
|
||||
}
|
||||
|
@ -195,7 +189,7 @@ namespace SafeExamBrowser.Client.Operations
|
|||
|
||||
private void InitializeAudioForActionCenter()
|
||||
{
|
||||
if (actionCenterSettings.ShowAudio)
|
||||
if (Context.Settings.ActionCenter.ShowAudio)
|
||||
{
|
||||
actionCenter.AddSystemControl(uiFactory.CreateAudioControl(audio, Location.ActionCenter));
|
||||
}
|
||||
|
@ -203,7 +197,7 @@ namespace SafeExamBrowser.Client.Operations
|
|||
|
||||
private void InitializeAudioForTaskbar()
|
||||
{
|
||||
if (taskbarSettings.ShowAudio)
|
||||
if (Context.Settings.Taskbar.ShowAudio)
|
||||
{
|
||||
taskbar.AddSystemControl(uiFactory.CreateAudioControl(audio, Location.Taskbar));
|
||||
}
|
||||
|
@ -211,17 +205,17 @@ namespace SafeExamBrowser.Client.Operations
|
|||
|
||||
private void InitializeClockForActionCenter()
|
||||
{
|
||||
actionCenter.ShowClock = actionCenterSettings.ShowClock;
|
||||
actionCenter.ShowClock = Context.Settings.ActionCenter.ShowClock;
|
||||
}
|
||||
|
||||
private void InitializeClockForTaskbar()
|
||||
{
|
||||
taskbar.ShowClock = taskbarSettings.ShowClock;
|
||||
taskbar.ShowClock = Context.Settings.Taskbar.ShowClock;
|
||||
}
|
||||
|
||||
private void InitializeLogNotificationForActionCenter()
|
||||
{
|
||||
if (actionCenterSettings.ShowApplicationLog)
|
||||
if (Context.Settings.ActionCenter.ShowApplicationLog)
|
||||
{
|
||||
actionCenter.AddNotificationControl(uiFactory.CreateNotificationControl(logController, logInfo, Location.ActionCenter));
|
||||
}
|
||||
|
@ -229,7 +223,7 @@ namespace SafeExamBrowser.Client.Operations
|
|||
|
||||
private void InitializeLogNotificationForTaskbar()
|
||||
{
|
||||
if (taskbarSettings.ShowApplicationLog)
|
||||
if (Context.Settings.Taskbar.ShowApplicationLog)
|
||||
{
|
||||
taskbar.AddNotificationControl(uiFactory.CreateNotificationControl(logController, logInfo, Location.Taskbar));
|
||||
}
|
||||
|
@ -237,7 +231,7 @@ namespace SafeExamBrowser.Client.Operations
|
|||
|
||||
private void InitializeKeyboardLayoutForActionCenter()
|
||||
{
|
||||
if (actionCenterSettings.ShowKeyboardLayout)
|
||||
if (Context.Settings.ActionCenter.ShowKeyboardLayout)
|
||||
{
|
||||
actionCenter.AddSystemControl(uiFactory.CreateKeyboardLayoutControl(keyboard, Location.ActionCenter));
|
||||
}
|
||||
|
@ -245,7 +239,7 @@ namespace SafeExamBrowser.Client.Operations
|
|||
|
||||
private void InitializeKeyboardLayoutForTaskbar()
|
||||
{
|
||||
if (taskbarSettings.ShowKeyboardLayout)
|
||||
if (Context.Settings.Taskbar.ShowKeyboardLayout)
|
||||
{
|
||||
taskbar.AddSystemControl(uiFactory.CreateKeyboardLayoutControl(keyboard, Location.Taskbar));
|
||||
}
|
||||
|
@ -269,7 +263,7 @@ namespace SafeExamBrowser.Client.Operations
|
|||
|
||||
private void InitializeWirelessNetworkForActionCenter()
|
||||
{
|
||||
if (actionCenterSettings.ShowWirelessNetwork)
|
||||
if (Context.Settings.ActionCenter.ShowWirelessNetwork)
|
||||
{
|
||||
actionCenter.AddSystemControl(uiFactory.CreateWirelessNetworkControl(wirelessAdapter, Location.ActionCenter));
|
||||
}
|
||||
|
@ -277,7 +271,7 @@ namespace SafeExamBrowser.Client.Operations
|
|||
|
||||
private void InitializeWirelessNetworkForTaskbar()
|
||||
{
|
||||
if (taskbarSettings.ShowWirelessNetwork)
|
||||
if (Context.Settings.Taskbar.ShowWirelessNetwork)
|
||||
{
|
||||
taskbar.AddSystemControl(uiFactory.CreateWirelessNetworkControl(wirelessAdapter, Location.Taskbar));
|
||||
}
|
||||
|
@ -287,7 +281,7 @@ namespace SafeExamBrowser.Client.Operations
|
|||
{
|
||||
terminationActivator.Stop();
|
||||
|
||||
if (actionCenterSettings.EnableActionCenter)
|
||||
if (Context.Settings.ActionCenter.EnableActionCenter)
|
||||
{
|
||||
foreach (var activator in activators)
|
||||
{
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace SafeExamBrowser.Monitoring.Keyboard
|
|||
private INativeMethods nativeMethods;
|
||||
private KeyboardSettings settings;
|
||||
|
||||
public KeyboardInterceptor(KeyboardSettings settings, ILogger logger, INativeMethods nativeMethods)
|
||||
public KeyboardInterceptor(ILogger logger, INativeMethods nativeMethods, KeyboardSettings settings)
|
||||
{
|
||||
this.logger = logger;
|
||||
this.nativeMethods = nativeMethods;
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace SafeExamBrowser.Monitoring.Mouse
|
|||
private INativeMethods nativeMethods;
|
||||
private MouseSettings settings;
|
||||
|
||||
public MouseInterceptor(ILogger logger, MouseSettings settings, INativeMethods nativeMethods)
|
||||
public MouseInterceptor(ILogger logger, INativeMethods nativeMethods, MouseSettings settings)
|
||||
{
|
||||
this.logger = logger;
|
||||
this.nativeMethods = nativeMethods;
|
||||
|
|
|
@ -11,23 +11,23 @@ using System;
|
|||
namespace SafeExamBrowser.Settings.Applications
|
||||
{
|
||||
/// <summary>
|
||||
/// TODO
|
||||
/// Defines an application which is blacklisted, i.e. not allowed to run during a session.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class BlacklistApplication
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// Specifies whether the application may be automatically terminated when starting a session.
|
||||
/// </summary>
|
||||
public bool AutoTerminate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// The name of the main executable of the application.
|
||||
/// </summary>
|
||||
public string ExecutableName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// The original file name of the main executable of the application, if available.
|
||||
/// </summary>
|
||||
public string ExecutableOriginalName { get; set; }
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue