SEBWIN-110: Refactored configuration so that all taskbar-related settings are in the same interface.
This commit is contained in:
parent
91a8e4d6e4
commit
a118f52ee3
9 changed files with 70 additions and 26 deletions
|
@ -59,6 +59,7 @@
|
||||||
<Compile Include="Settings.cs" />
|
<Compile Include="Settings.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="SystemInfo.cs" />
|
<Compile Include="SystemInfo.cs" />
|
||||||
|
<Compile Include="TaskbarSettings.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\SafeExamBrowser.Contracts\SafeExamBrowser.Contracts.csproj">
|
<ProjectReference Include="..\SafeExamBrowser.Contracts\SafeExamBrowser.Contracts.csproj">
|
||||||
|
|
|
@ -25,21 +25,21 @@ namespace SafeExamBrowser.Configuration
|
||||||
Browser = new BrowserSettings(this);
|
Browser = new BrowserSettings(this);
|
||||||
Keyboard = new KeyboardSettings();
|
Keyboard = new KeyboardSettings();
|
||||||
Mouse = new MouseSettings();
|
Mouse = new MouseSettings();
|
||||||
|
Taskbar = new TaskbarSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AllowApplicationLog => true;
|
|
||||||
public bool AllowKeyboardLayout => true;
|
|
||||||
public string AppDataFolderName => nameof(SafeExamBrowser);
|
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
|
public string ApplicationLogFile
|
||||||
{
|
{
|
||||||
get { return Path.Combine(LogFolderPath, $"{RuntimeIdentifier}_Application.txt"); }
|
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
|
public string LogFolderPath
|
||||||
{
|
{
|
||||||
get { return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), AppDataFolderName, "Logs"); }
|
get { return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), AppDataFolderName, "Logs"); }
|
||||||
|
|
19
SafeExamBrowser.Configuration/TaskbarSettings.cs
Normal file
19
SafeExamBrowser.Configuration/TaskbarSettings.cs
Normal file
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,16 +10,6 @@ namespace SafeExamBrowser.Contracts.Configuration.Settings
|
||||||
{
|
{
|
||||||
public interface ISettings
|
public interface ISettings
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Determines whether the user may access the application log during runtime.
|
|
||||||
/// </summary>
|
|
||||||
bool AllowApplicationLog { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Determines whether the user may switch the keyboard layout during runtime.
|
|
||||||
/// </summary>
|
|
||||||
bool AllowKeyboardLayout { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The name used for the application data folder.
|
/// The name used for the application data folder.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -40,16 +30,16 @@ namespace SafeExamBrowser.Contracts.Configuration.Settings
|
||||||
/// </summary>
|
/// </summary>
|
||||||
IKeyboardSettings Keyboard { get; }
|
IKeyboardSettings Keyboard { get; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// All mouse-related settings.
|
|
||||||
/// </summary>
|
|
||||||
IMouseSettings Mouse { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The path where the log files are to be stored.
|
/// The path where the log files are to be stored.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string LogFolderPath { get; }
|
string LogFolderPath { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// All mouse-related settings.
|
||||||
|
/// </summary>
|
||||||
|
IMouseSettings Mouse { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The copyright information for the application (i.e. the executing assembly).
|
/// The copyright information for the application (i.e. the executing assembly).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -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.
|
/// A string uniquely identifying the runtime of the application, used e.g. for the log file names.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string RuntimeIdentifier { get; }
|
string RuntimeIdentifier { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// All taskbar-related settings.
|
||||||
|
/// </summary>
|
||||||
|
ITaskbarSettings Taskbar { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether the user may switch the keyboard layout during runtime.
|
||||||
|
/// </summary>
|
||||||
|
bool AllowKeyboardLayout { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether the user may access the application log during runtime.
|
||||||
|
/// </summary>
|
||||||
|
bool AllowApplicationLog { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether the user may control the wireless network connection during runtime.
|
||||||
|
/// </summary>
|
||||||
|
bool AllowWirelessNetwork { get; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -68,6 +68,7 @@
|
||||||
<Compile Include="Configuration\Settings\ISettings.cs" />
|
<Compile Include="Configuration\Settings\ISettings.cs" />
|
||||||
<Compile Include="Behaviour\IShutdownController.cs" />
|
<Compile Include="Behaviour\IShutdownController.cs" />
|
||||||
<Compile Include="Behaviour\IStartupController.cs" />
|
<Compile Include="Behaviour\IStartupController.cs" />
|
||||||
|
<Compile Include="Configuration\Settings\ITaskbarSettings.cs" />
|
||||||
<Compile Include="I18n\IText.cs" />
|
<Compile Include="I18n\IText.cs" />
|
||||||
<Compile Include="I18n\TextKey.cs" />
|
<Compile Include="I18n\TextKey.cs" />
|
||||||
<Compile Include="Logging\ILogContent.cs" />
|
<Compile Include="Logging\ILogContent.cs" />
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace SafeExamBrowser.Core.UnitTests.Behaviour.Operations
|
||||||
public class TaskbarOperationTests
|
public class TaskbarOperationTests
|
||||||
{
|
{
|
||||||
private Mock<ILogger> loggerMock;
|
private Mock<ILogger> loggerMock;
|
||||||
private Mock<ISettings> settingsMock;
|
private Mock<ITaskbarSettings> settingsMock;
|
||||||
private Mock<ISplashScreen> splashScreenMock;
|
private Mock<ISplashScreen> splashScreenMock;
|
||||||
private Mock<ISystemComponent<ISystemKeyboardLayoutControl>> keyboardLayoutMock;
|
private Mock<ISystemComponent<ISystemKeyboardLayoutControl>> keyboardLayoutMock;
|
||||||
private Mock<ISystemComponent<ISystemPowerSupplyControl>> powerSupplyMock;
|
private Mock<ISystemComponent<ISystemPowerSupplyControl>> powerSupplyMock;
|
||||||
|
@ -38,7 +38,7 @@ namespace SafeExamBrowser.Core.UnitTests.Behaviour.Operations
|
||||||
public void Initialize()
|
public void Initialize()
|
||||||
{
|
{
|
||||||
loggerMock = new Mock<ILogger>();
|
loggerMock = new Mock<ILogger>();
|
||||||
settingsMock = new Mock<ISettings>();
|
settingsMock = new Mock<ITaskbarSettings>();
|
||||||
splashScreenMock = new Mock<ISplashScreen>();
|
splashScreenMock = new Mock<ISplashScreen>();
|
||||||
keyboardLayoutMock = new Mock<ISystemComponent<ISystemKeyboardLayoutControl>>();
|
keyboardLayoutMock = new Mock<ISystemComponent<ISystemKeyboardLayoutControl>>();
|
||||||
powerSupplyMock = new Mock<ISystemComponent<ISystemPowerSupplyControl>>();
|
powerSupplyMock = new Mock<ISystemComponent<ISystemPowerSupplyControl>>();
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace SafeExamBrowser.Core.Behaviour.Operations
|
||||||
{
|
{
|
||||||
private ILogger logger;
|
private ILogger logger;
|
||||||
private INotificationController logController;
|
private INotificationController logController;
|
||||||
private ISettings settings;
|
private ITaskbarSettings settings;
|
||||||
private ISystemComponent<ISystemKeyboardLayoutControl> keyboardLayout;
|
private ISystemComponent<ISystemKeyboardLayoutControl> keyboardLayout;
|
||||||
private ISystemComponent<ISystemPowerSupplyControl> powerSupply;
|
private ISystemComponent<ISystemPowerSupplyControl> powerSupply;
|
||||||
private ISystemInfo systemInfo;
|
private ISystemInfo systemInfo;
|
||||||
|
@ -34,7 +34,7 @@ namespace SafeExamBrowser.Core.Behaviour.Operations
|
||||||
|
|
||||||
public TaskbarOperation(
|
public TaskbarOperation(
|
||||||
ILogger logger,
|
ILogger logger,
|
||||||
ISettings settings,
|
ITaskbarSettings settings,
|
||||||
ISystemComponent<ISystemKeyboardLayoutControl> keyboardLayout,
|
ISystemComponent<ISystemKeyboardLayoutControl> keyboardLayout,
|
||||||
ISystemComponent<ISystemPowerSupplyControl> powerSupply,
|
ISystemComponent<ISystemPowerSupplyControl> powerSupply,
|
||||||
ISystemInfo systemInfo,
|
ISystemInfo systemInfo,
|
||||||
|
|
|
@ -92,7 +92,7 @@ namespace SafeExamBrowser
|
||||||
StartupOperations.Enqueue(new WindowMonitorOperation(logger, windowMonitor));
|
StartupOperations.Enqueue(new WindowMonitorOperation(logger, windowMonitor));
|
||||||
StartupOperations.Enqueue(new ProcessMonitorOperation(logger, processMonitor));
|
StartupOperations.Enqueue(new ProcessMonitorOperation(logger, processMonitor));
|
||||||
StartupOperations.Enqueue(new DisplayMonitorOperation(displayMonitor, logger, Taskbar));
|
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 BrowserOperation(browserController, browserInfo, logger, Taskbar, uiFactory));
|
||||||
StartupOperations.Enqueue(new RuntimeControllerOperation(runtimeController, logger));
|
StartupOperations.Enqueue(new RuntimeControllerOperation(runtimeController, logger));
|
||||||
StartupOperations.Enqueue(new ClipboardOperation(logger, nativeMethods));
|
StartupOperations.Enqueue(new ClipboardOperation(logger, nativeMethods));
|
||||||
|
|
Loading…
Reference in a new issue