diff --git a/SafeExamBrowser.Configuration/SafeExamBrowser.Configuration.csproj b/SafeExamBrowser.Configuration/SafeExamBrowser.Configuration.csproj index fc74bef9..657a7307 100644 --- a/SafeExamBrowser.Configuration/SafeExamBrowser.Configuration.csproj +++ b/SafeExamBrowser.Configuration/SafeExamBrowser.Configuration.csproj @@ -59,6 +59,7 @@ + diff --git a/SafeExamBrowser.Configuration/Settings.cs b/SafeExamBrowser.Configuration/Settings.cs index bfed33a7..bf237484 100644 --- a/SafeExamBrowser.Configuration/Settings.cs +++ b/SafeExamBrowser.Configuration/Settings.cs @@ -25,21 +25,21 @@ namespace SafeExamBrowser.Configuration Browser = new BrowserSettings(this); Keyboard = new KeyboardSettings(); Mouse = new MouseSettings(); + Taskbar = new TaskbarSettings(); } - public bool AllowApplicationLog => true; - public bool AllowKeyboardLayout => true; public string AppDataFolderName => nameof(SafeExamBrowser); + public IBrowserSettings Browser { get; private set; } + public IKeyboardSettings Keyboard { get; private set; } + public IMouseSettings Mouse { get; private set; } + public ITaskbarSettings Taskbar { get; private set; } + public string ApplicationLogFile { get { return Path.Combine(LogFolderPath, $"{RuntimeIdentifier}_Application.txt"); } } - public IBrowserSettings Browser { get; private set; } - public IKeyboardSettings Keyboard { get; private set; } - public IMouseSettings Mouse { get; private set; } - public string LogFolderPath { get { return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), AppDataFolderName, "Logs"); } diff --git a/SafeExamBrowser.Configuration/TaskbarSettings.cs b/SafeExamBrowser.Configuration/TaskbarSettings.cs new file mode 100644 index 00000000..6287f999 --- /dev/null +++ b/SafeExamBrowser.Configuration/TaskbarSettings.cs @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2017 ETH Zürich, Educational Development and Technology (LET) + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +using SafeExamBrowser.Contracts.Configuration.Settings; + +namespace SafeExamBrowser.Configuration +{ + public class TaskbarSettings : ITaskbarSettings + { + public bool AllowApplicationLog => true; + public bool AllowKeyboardLayout => true; + public bool AllowWirelessNetwork => true; + } +} diff --git a/SafeExamBrowser.Contracts/Configuration/Settings/ISettings.cs b/SafeExamBrowser.Contracts/Configuration/Settings/ISettings.cs index c2fb15a3..51f3c840 100644 --- a/SafeExamBrowser.Contracts/Configuration/Settings/ISettings.cs +++ b/SafeExamBrowser.Contracts/Configuration/Settings/ISettings.cs @@ -10,16 +10,6 @@ namespace SafeExamBrowser.Contracts.Configuration.Settings { public interface ISettings { - /// - /// Determines whether the user may access the application log during runtime. - /// - bool AllowApplicationLog { get; } - - /// - /// Determines whether the user may switch the keyboard layout during runtime. - /// - bool AllowKeyboardLayout { get; } - /// /// The name used for the application data folder. /// @@ -40,16 +30,16 @@ namespace SafeExamBrowser.Contracts.Configuration.Settings /// IKeyboardSettings Keyboard { get; } - /// - /// All mouse-related settings. - /// - IMouseSettings Mouse { get; } - /// /// The path where the log files are to be stored. /// string LogFolderPath { get; } + /// + /// All mouse-related settings. + /// + IMouseSettings Mouse { get; } + /// /// The copyright information for the application (i.e. the executing assembly). /// @@ -69,5 +59,10 @@ namespace SafeExamBrowser.Contracts.Configuration.Settings /// A string uniquely identifying the runtime of the application, used e.g. for the log file names. /// string RuntimeIdentifier { get; } + + /// + /// All taskbar-related settings. + /// + ITaskbarSettings Taskbar { get; } } } diff --git a/SafeExamBrowser.Contracts/Configuration/Settings/ITaskbarSettings.cs b/SafeExamBrowser.Contracts/Configuration/Settings/ITaskbarSettings.cs new file mode 100644 index 00000000..0c3e6edb --- /dev/null +++ b/SafeExamBrowser.Contracts/Configuration/Settings/ITaskbarSettings.cs @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2017 ETH Zürich, Educational Development and Technology (LET) + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +namespace SafeExamBrowser.Contracts.Configuration.Settings +{ + public interface ITaskbarSettings + { + /// + /// Determines whether the user may switch the keyboard layout during runtime. + /// + bool AllowKeyboardLayout { get; } + + /// + /// Determines whether the user may access the application log during runtime. + /// + bool AllowApplicationLog { get; } + + /// + /// Determines whether the user may control the wireless network connection during runtime. + /// + bool AllowWirelessNetwork { get; } + } +} diff --git a/SafeExamBrowser.Contracts/SafeExamBrowser.Contracts.csproj b/SafeExamBrowser.Contracts/SafeExamBrowser.Contracts.csproj index c5142fc6..7b2d5ed4 100644 --- a/SafeExamBrowser.Contracts/SafeExamBrowser.Contracts.csproj +++ b/SafeExamBrowser.Contracts/SafeExamBrowser.Contracts.csproj @@ -68,6 +68,7 @@ + diff --git a/SafeExamBrowser.Core.UnitTests/Behaviour/Operations/TaskbarOperationTests.cs b/SafeExamBrowser.Core.UnitTests/Behaviour/Operations/TaskbarOperationTests.cs index 0fb4c23b..cef3dd39 100644 --- a/SafeExamBrowser.Core.UnitTests/Behaviour/Operations/TaskbarOperationTests.cs +++ b/SafeExamBrowser.Core.UnitTests/Behaviour/Operations/TaskbarOperationTests.cs @@ -23,7 +23,7 @@ namespace SafeExamBrowser.Core.UnitTests.Behaviour.Operations public class TaskbarOperationTests { private Mock loggerMock; - private Mock settingsMock; + private Mock settingsMock; private Mock splashScreenMock; private Mock> keyboardLayoutMock; private Mock> powerSupplyMock; @@ -38,7 +38,7 @@ namespace SafeExamBrowser.Core.UnitTests.Behaviour.Operations public void Initialize() { loggerMock = new Mock(); - settingsMock = new Mock(); + settingsMock = new Mock(); splashScreenMock = new Mock(); keyboardLayoutMock = new Mock>(); powerSupplyMock = new Mock>(); diff --git a/SafeExamBrowser.Core/Behaviour/Operations/TaskbarOperation.cs b/SafeExamBrowser.Core/Behaviour/Operations/TaskbarOperation.cs index 189c75bf..2753f309 100644 --- a/SafeExamBrowser.Core/Behaviour/Operations/TaskbarOperation.cs +++ b/SafeExamBrowser.Core/Behaviour/Operations/TaskbarOperation.cs @@ -22,7 +22,7 @@ namespace SafeExamBrowser.Core.Behaviour.Operations { private ILogger logger; private INotificationController logController; - private ISettings settings; + private ITaskbarSettings settings; private ISystemComponent keyboardLayout; private ISystemComponent powerSupply; private ISystemInfo systemInfo; @@ -34,7 +34,7 @@ namespace SafeExamBrowser.Core.Behaviour.Operations public TaskbarOperation( ILogger logger, - ISettings settings, + ITaskbarSettings settings, ISystemComponent keyboardLayout, ISystemComponent powerSupply, ISystemInfo systemInfo, diff --git a/SafeExamBrowser/CompositionRoot.cs b/SafeExamBrowser/CompositionRoot.cs index 8c4c4c72..417b5b5d 100644 --- a/SafeExamBrowser/CompositionRoot.cs +++ b/SafeExamBrowser/CompositionRoot.cs @@ -92,7 +92,7 @@ namespace SafeExamBrowser StartupOperations.Enqueue(new WindowMonitorOperation(logger, windowMonitor)); StartupOperations.Enqueue(new ProcessMonitorOperation(logger, processMonitor)); StartupOperations.Enqueue(new DisplayMonitorOperation(displayMonitor, logger, Taskbar)); - StartupOperations.Enqueue(new TaskbarOperation(logger, settings, keyboardLayout, powerSupply, systemInfo, Taskbar, text, uiFactory)); + StartupOperations.Enqueue(new TaskbarOperation(logger, settings.Taskbar, keyboardLayout, powerSupply, systemInfo, Taskbar, text, uiFactory)); StartupOperations.Enqueue(new BrowserOperation(browserController, browserInfo, logger, Taskbar, uiFactory)); StartupOperations.Enqueue(new RuntimeControllerOperation(runtimeController, logger)); StartupOperations.Enqueue(new ClipboardOperation(logger, nativeMethods));