From 7c58c10b8682966f4c880927c629121a5ada330a Mon Sep 17 00:00:00 2001 From: dbuechel Date: Wed, 9 Jan 2019 16:01:56 +0100 Subject: [PATCH] SEBWIN-112, SEBWIN-113: Implemented data value mapping for keyboard and mouse configuration. --- .../Operations/TaskbarOperationTests.cs | 3 +- .../Operations/TaskbarOperation.cs | 18 +- ...Certificates.cs => CertificateImporter.cs} | 6 +- .../DataMapper.ConfigurationFile.cs | 25 +++ .../ConfigurationData/DataMapper.General.cs | 31 ++++ .../ConfigurationData/DataMapper.Input.cs | 175 ++++++++++++++++++ .../ConfigurationData/DataMapper.cs | 90 ++++++--- .../ConfigurationData/Keys.cs | 67 ++++--- .../ConfigurationRepository.cs | 12 +- .../SafeExamBrowser.Configuration.csproj | 11 +- .../Settings/KeyboardSettings.cs | 80 ++++++++ .../Keyboard/KeyboardInterceptor.cs | 43 +++-- .../Mouse/MouseInterceptor.cs | 4 +- .../AboutWindow.xaml | 8 +- 14 files changed, 476 insertions(+), 97 deletions(-) rename SafeExamBrowser.Configuration/ConfigurationData/{Certificates.cs => CertificateImporter.cs} (93%) create mode 100644 SafeExamBrowser.Configuration/ConfigurationData/DataMapper.ConfigurationFile.cs create mode 100644 SafeExamBrowser.Configuration/ConfigurationData/DataMapper.General.cs create mode 100644 SafeExamBrowser.Configuration/ConfigurationData/DataMapper.Input.cs diff --git a/SafeExamBrowser.Client.UnitTests/Operations/TaskbarOperationTests.cs b/SafeExamBrowser.Client.UnitTests/Operations/TaskbarOperationTests.cs index a8bf3a0a..a0a06bf1 100644 --- a/SafeExamBrowser.Client.UnitTests/Operations/TaskbarOperationTests.cs +++ b/SafeExamBrowser.Client.UnitTests/Operations/TaskbarOperationTests.cs @@ -87,7 +87,7 @@ namespace SafeExamBrowser.Client.UnitTests.Operations powerSupplyMock.Verify(p => p.Initialize(It.IsAny()), Times.Once); wirelessNetworkMock.Verify(w => w.Initialize(It.IsAny()), Times.Once); taskbarMock.Verify(t => t.AddSystemControl(It.IsAny()), Times.Exactly(3)); - taskbarMock.Verify(t => t.AddNotification(It.IsAny()), Times.Once); + taskbarMock.Verify(t => t.AddNotification(It.IsAny()), Times.Exactly(2)); } [TestMethod] @@ -95,6 +95,7 @@ namespace SafeExamBrowser.Client.UnitTests.Operations { sut.Revert(); + aboutControllerMock.Verify(c => c.Terminate(), Times.Once); keyboardLayoutMock.Verify(k => k.Terminate(), Times.Once); powerSupplyMock.Verify(p => p.Terminate(), Times.Once); wirelessNetworkMock.Verify(w => w.Terminate(), Times.Once); diff --git a/SafeExamBrowser.Client/Operations/TaskbarOperation.cs b/SafeExamBrowser.Client/Operations/TaskbarOperation.cs index a03ae751..6da1e150 100644 --- a/SafeExamBrowser.Client/Operations/TaskbarOperation.cs +++ b/SafeExamBrowser.Client/Operations/TaskbarOperation.cs @@ -77,7 +77,7 @@ namespace SafeExamBrowser.Client.Operations if (settings.AllowApplicationLog) { - CreateLogNotification(); + AddLogNotification(); } if (settings.AllowKeyboardLayout) @@ -144,6 +144,14 @@ namespace SafeExamBrowser.Client.Operations taskbar.AddSystemControl(control); } + private void AddLogNotification() + { + var logNotification = uiFactory.CreateNotification(logInfo); + + logController.RegisterNotification(logNotification); + taskbar.AddNotification(logNotification); + } + private void AddPowerSupplyControl() { var control = uiFactory.CreatePowerSupplyControl(); @@ -159,13 +167,5 @@ namespace SafeExamBrowser.Client.Operations wirelessNetwork.Initialize(control); taskbar.AddSystemControl(control); } - - private void CreateLogNotification() - { - var logNotification = uiFactory.CreateNotification(logInfo); - - logController.RegisterNotification(logNotification); - taskbar.AddNotification(logNotification); - } } } diff --git a/SafeExamBrowser.Configuration/ConfigurationData/Certificates.cs b/SafeExamBrowser.Configuration/ConfigurationData/CertificateImporter.cs similarity index 93% rename from SafeExamBrowser.Configuration/ConfigurationData/Certificates.cs rename to SafeExamBrowser.Configuration/ConfigurationData/CertificateImporter.cs index bc416089..ae949246 100644 --- a/SafeExamBrowser.Configuration/ConfigurationData/Certificates.cs +++ b/SafeExamBrowser.Configuration/ConfigurationData/CertificateImporter.cs @@ -13,16 +13,16 @@ using SafeExamBrowser.Contracts.Logging; namespace SafeExamBrowser.Configuration.ConfigurationData { - internal class Certificates + internal class CertificateImporter { private ILogger logger; - internal Certificates(ILogger logger) + internal CertificateImporter(ILogger logger) { this.logger = logger; } - internal void ExtractAndImportIdentityCertificates(IDictionary data) + internal void ExtractAndImportIdentities(IDictionary data) { const int IDENTITY_CERTIFICATE = 1; var hasCertificates = data.TryGetValue(Keys.Network.Certificates.EmbeddedCertificates, out var value); diff --git a/SafeExamBrowser.Configuration/ConfigurationData/DataMapper.ConfigurationFile.cs b/SafeExamBrowser.Configuration/ConfigurationData/DataMapper.ConfigurationFile.cs new file mode 100644 index 00000000..74220a19 --- /dev/null +++ b/SafeExamBrowser.Configuration/ConfigurationData/DataMapper.ConfigurationFile.cs @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2019 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.ConfigurationData +{ + internal partial class DataMapper + { + private void MapConfigurationMode(Settings settings, object value) + { + const int CONFIGURE_CLIENT = 1; + + if (value is int mode) + { + settings.ConfigurationMode = mode == CONFIGURE_CLIENT ? ConfigurationMode.ConfigureClient : ConfigurationMode.Exam; + } + } + } +} diff --git a/SafeExamBrowser.Configuration/ConfigurationData/DataMapper.General.cs b/SafeExamBrowser.Configuration/ConfigurationData/DataMapper.General.cs new file mode 100644 index 00000000..a116da61 --- /dev/null +++ b/SafeExamBrowser.Configuration/ConfigurationData/DataMapper.General.cs @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2019 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.ConfigurationData +{ + internal partial class DataMapper + { + private void MapAdminPasswordHash(Settings settings, object value) + { + if (value is string hash) + { + settings.AdminPasswordHash = hash; + } + } + + private void MapStartUrl(Settings settings, object value) + { + if (value is string url) + { + settings.Browser.StartUrl = url; + } + } + } +} diff --git a/SafeExamBrowser.Configuration/ConfigurationData/DataMapper.Input.cs b/SafeExamBrowser.Configuration/ConfigurationData/DataMapper.Input.cs new file mode 100644 index 00000000..c65f066a --- /dev/null +++ b/SafeExamBrowser.Configuration/ConfigurationData/DataMapper.Input.cs @@ -0,0 +1,175 @@ +/* + * Copyright (c) 2019 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.ConfigurationData +{ + internal partial class DataMapper + { + private void MapEnableAltEsc(Settings settings, object value) + { + if (value is bool enabled) + { + settings.Keyboard.AllowAltEsc = enabled; + } + } + + private void MapEnableAltF4(Settings settings, object value) + { + if (value is bool enabled) + { + settings.Keyboard.AllowAltF4 = enabled; + } + } + + private void MapEnableAltTab(Settings settings, object value) + { + if (value is bool enabled) + { + settings.Keyboard.AllowAltTab = enabled; + } + } + + private void MapEnableCtrlEsc(Settings settings, object value) + { + if (value is bool enabled) + { + settings.Keyboard.AllowCtrlEsc = enabled; + } + } + + private void MapEnableEsc(Settings settings, object value) + { + if (value is bool enabled) + { + settings.Keyboard.AllowEsc = enabled; + } + } + + private void MapEnableF1(Settings settings, object value) + { + if (value is bool enabled) + { + settings.Keyboard.AllowF1 = enabled; + } + } + + private void MapEnableF2(Settings settings, object value) + { + if (value is bool enabled) + { + settings.Keyboard.AllowF2 = enabled; + } + } + + private void MapEnableF3(Settings settings, object value) + { + if (value is bool enabled) + { + settings.Keyboard.AllowF3 = enabled; + } + } + + private void MapEnableF4(Settings settings, object value) + { + if (value is bool enabled) + { + settings.Keyboard.AllowF4 = enabled; + } + } + + private void MapEnableF5(Settings settings, object value) + { + if (value is bool enabled) + { + settings.Keyboard.AllowF5 = enabled; + } + } + + private void MapEnableF6(Settings settings, object value) + { + if (value is bool enabled) + { + settings.Keyboard.AllowF6 = enabled; + } + } + + private void MapEnableF7(Settings settings, object value) + { + if (value is bool enabled) + { + settings.Keyboard.AllowF7 = enabled; + } + } + + private void MapEnableF8(Settings settings, object value) + { + if (value is bool enabled) + { + settings.Keyboard.AllowF8 = enabled; + } + } + + private void MapEnableF9(Settings settings, object value) + { + if (value is bool enabled) + { + settings.Keyboard.AllowF9 = enabled; + } + } + + private void MapEnableF10(Settings settings, object value) + { + if (value is bool enabled) + { + settings.Keyboard.AllowF10 = enabled; + } + } + + private void MapEnableF11(Settings settings, object value) + { + if (value is bool enabled) + { + settings.Keyboard.AllowF11 = enabled; + } + } + + private void MapEnableF12(Settings settings, object value) + { + if (value is bool enabled) + { + settings.Keyboard.AllowF12 = enabled; + } + } + + private void MapEnablePrintScreen(Settings settings, object value) + { + if (value is bool enabled) + { + settings.Keyboard.AllowPrintScreen = enabled; + } + } + + private void MapEnableSystemKey(Settings settings, object value) + { + if (value is bool enabled) + { + settings.Keyboard.AllowSystemKey = enabled; + } + } + + private void MapEnableRightMouse(Settings settings, object value) + { + if (value is bool enabled) + { + settings.Mouse.AllowRightButton = enabled; + } + } + } +} diff --git a/SafeExamBrowser.Configuration/ConfigurationData/DataMapper.cs b/SafeExamBrowser.Configuration/ConfigurationData/DataMapper.cs index 1bca4fc2..77b32b44 100644 --- a/SafeExamBrowser.Configuration/ConfigurationData/DataMapper.cs +++ b/SafeExamBrowser.Configuration/ConfigurationData/DataMapper.cs @@ -11,7 +11,7 @@ using SafeExamBrowser.Contracts.Configuration.Settings; namespace SafeExamBrowser.Configuration.ConfigurationData { - internal class DataMapper + internal partial class DataMapper { internal void MapRawDataToSettings(IDictionary rawData, Settings settings) { @@ -25,39 +25,75 @@ namespace SafeExamBrowser.Configuration.ConfigurationData { switch (key) { + case Keys.ConfigurationFile.ConfigurationPurpose: + MapConfigurationMode(settings, value); + break; case Keys.General.AdminPasswordHash: MapAdminPasswordHash(settings, value); break; case Keys.General.StartUrl: MapStartUrl(settings, value); break; - case Keys.ConfigurationFile.ConfigurationPurpose: - MapConfigurationMode(settings, value); + case Keys.Input.Keyboard.EnableAltEsc: + MapEnableAltEsc(settings, value); + break; + case Keys.Input.Keyboard.EnableAltF4: + MapEnableAltF4(settings, value); + break; + case Keys.Input.Keyboard.EnableAltTab: + MapEnableAltTab(settings, value); + break; + case Keys.Input.Keyboard.EnableCtrlEsc: + MapEnableCtrlEsc(settings, value); + break; + case Keys.Input.Keyboard.EnableEsc: + MapEnableEsc(settings, value); + break; + case Keys.Input.Keyboard.EnableF1: + MapEnableF1(settings, value); + break; + case Keys.Input.Keyboard.EnableF2: + MapEnableF2(settings, value); + break; + case Keys.Input.Keyboard.EnableF3: + MapEnableF3(settings, value); + break; + case Keys.Input.Keyboard.EnableF4: + MapEnableF4(settings, value); + break; + case Keys.Input.Keyboard.EnableF5: + MapEnableF5(settings, value); + break; + case Keys.Input.Keyboard.EnableF6: + MapEnableF6(settings, value); + break; + case Keys.Input.Keyboard.EnableF7: + MapEnableF7(settings, value); + break; + case Keys.Input.Keyboard.EnableF8: + MapEnableF8(settings, value); + break; + case Keys.Input.Keyboard.EnableF9: + MapEnableF9(settings, value); + break; + case Keys.Input.Keyboard.EnableF10: + MapEnableF10(settings, value); + break; + case Keys.Input.Keyboard.EnableF11: + MapEnableF11(settings, value); + break; + case Keys.Input.Keyboard.EnableF12: + MapEnableF12(settings, value); + break; + case Keys.Input.Keyboard.EnablePrintScreen: + MapEnablePrintScreen(settings, value); + break; + case Keys.Input.Keyboard.EnableSystemKey: + MapEnableSystemKey(settings, value); + break; + case Keys.Input.Mouse.EnableRightMouse: + MapEnableRightMouse(settings, value); break; - } - } - - private void MapAdminPasswordHash(Settings settings, object value) - { - if (value is string hash) - { - settings.AdminPasswordHash = hash; - } - } - - private void MapConfigurationMode(Settings settings, object value) - { - if (value is int mode) - { - settings.ConfigurationMode = mode == 1 ? ConfigurationMode.ConfigureClient : ConfigurationMode.Exam; - } - } - - private void MapStartUrl(Settings settings, object value) - { - if (value is string url) - { - settings.Browser.StartUrl = url; } } } diff --git a/SafeExamBrowser.Configuration/ConfigurationData/Keys.cs b/SafeExamBrowser.Configuration/ConfigurationData/Keys.cs index 81db0f2a..698a068e 100644 --- a/SafeExamBrowser.Configuration/ConfigurationData/Keys.cs +++ b/SafeExamBrowser.Configuration/ConfigurationData/Keys.cs @@ -10,10 +10,16 @@ namespace SafeExamBrowser.Configuration.ConfigurationData { internal static class Keys { - internal static class General + internal static class AdditionalResources + { + } + + internal static class Applications + { + } + + internal static class Browser { - internal const string AdminPasswordHash = "hashedAdminPassword"; - internal const string StartUrl = "startURL"; } internal static class ConfigurationFile @@ -22,28 +28,45 @@ namespace SafeExamBrowser.Configuration.ConfigurationData internal const string KeepClientConfigEncryption = "clientConfigKeepEncryption"; } - internal static class UserInterface - { - } - - internal static class Browser - { - } - - internal static class DownUploads - { - } - internal static class Exam { } - internal static class Applications + internal static class General { + internal const string AdminPasswordHash = "hashedAdminPassword"; + internal const string StartUrl = "startURL"; } - internal static class AdditionalResources + internal static class Input { + internal static class Keyboard + { + public const string EnableAltEsc = "enableAltEsc"; + public const string EnableAltTab = "enableAltTab"; + public const string EnableAltF4 = "enableAltF4"; + public const string EnableCtrlEsc = "enableCtrlEsc"; + public const string EnableEsc = "enableEsc"; + public const string EnableF1 = "enableF1"; + public const string EnableF2 = "enableF2"; + public const string EnableF3 = "enableF3"; + public const string EnableF4 = "enableF4"; + public const string EnableF5 = "enableF5"; + public const string EnableF6 = "enableF6"; + public const string EnableF7 = "enableF7"; + public const string EnableF8 = "enableF8"; + public const string EnableF9 = "enableF9"; + public const string EnableF10 = "enableF10"; + public const string EnableF11 = "enableF11"; + public const string EnableF12 = "enableF12"; + public const string EnablePrintScreen = "enablePrintScreen"; + public const string EnableSystemKey = "enableStartMenu"; + } + + internal static class Mouse + { + public const string EnableRightMouse = "enableRightMouse"; + } } internal static class Network @@ -56,15 +79,15 @@ namespace SafeExamBrowser.Configuration.ConfigurationData } } - internal static class Security - { - } - internal static class Registry { } - internal static class HookedKeys + internal static class Security + { + } + + internal static class UserInterface { } } diff --git a/SafeExamBrowser.Configuration/ConfigurationRepository.cs b/SafeExamBrowser.Configuration/ConfigurationRepository.cs index 32cc0a94..3e56ac87 100644 --- a/SafeExamBrowser.Configuration/ConfigurationRepository.cs +++ b/SafeExamBrowser.Configuration/ConfigurationRepository.cs @@ -22,7 +22,7 @@ namespace SafeExamBrowser.Configuration { public class ConfigurationRepository : IConfigurationRepository { - private Certificates certificates; + private CertificateImporter certificateImporter; private IList dataParsers; private IList dataSerializers; private DataMapper dataMapper; @@ -40,16 +40,16 @@ namespace SafeExamBrowser.Configuration string programTitle, string programVersion) { - certificates = new Certificates(logger.CloneFor(nameof(Certificates))); + this.hashAlgorithm = hashAlgorithm; + this.logger = logger; + + certificateImporter = new CertificateImporter(logger.CloneFor(nameof(CertificateImporter))); dataParsers = new List(); dataSerializers = new List(); dataMapper = new DataMapper(); dataValues = new DataValues(executablePath, programCopyright, programTitle, programVersion); resourceLoaders = new List(); resourceSavers = new List(); - - this.hashAlgorithm = hashAlgorithm; - this.logger = logger; } public SaveStatus ConfigureClientWith(Uri resource, PasswordParameters password = null) @@ -64,7 +64,7 @@ namespace SafeExamBrowser.Configuration { TryParseData(data, out var encryption, out var format, out var rawData, password); - certificates.ExtractAndImportIdentityCertificates(rawData); + certificateImporter.ExtractAndImportIdentities(rawData); encryption = DetermineEncryptionForClientConfiguration(rawData, encryption); var status = TrySerializeData(rawData, format, out var serialized, encryption); diff --git a/SafeExamBrowser.Configuration/SafeExamBrowser.Configuration.csproj b/SafeExamBrowser.Configuration/SafeExamBrowser.Configuration.csproj index 88e71186..0efb7d80 100644 --- a/SafeExamBrowser.Configuration/SafeExamBrowser.Configuration.csproj +++ b/SafeExamBrowser.Configuration/SafeExamBrowser.Configuration.csproj @@ -58,7 +58,7 @@ - + @@ -69,6 +69,15 @@ + + DataMapper.cs + + + DataMapper.cs + + + DataMapper.cs + diff --git a/SafeExamBrowser.Contracts/Configuration/Settings/KeyboardSettings.cs b/SafeExamBrowser.Contracts/Configuration/Settings/KeyboardSettings.cs index 50a922ca..4158c5e8 100644 --- a/SafeExamBrowser.Contracts/Configuration/Settings/KeyboardSettings.cs +++ b/SafeExamBrowser.Contracts/Configuration/Settings/KeyboardSettings.cs @@ -16,19 +16,99 @@ namespace SafeExamBrowser.Contracts.Configuration.Settings [Serializable] public class KeyboardSettings { + /// + /// Determines whether the user may use the ALT+ESC shortcut. + /// + public bool AllowAltEsc { get; set; } + + /// + /// Determines whether the user may use the ALT+F4 shortcut. + /// + public bool AllowAltF4 { get; set; } + /// /// Determines whether the user may use the ALT+TAB shortcut. /// public bool AllowAltTab { get; set; } + /// + /// Determines whether the user may use the CTRL+ESC shortcut. + /// + public bool AllowCtrlEsc { get; set; } + /// /// Determines whether the user may use the escape key. /// public bool AllowEsc { get; set; } + /// + /// Determines whether the user may use the F1 key. + /// + public bool AllowF1 { get; set; } + + /// + /// Determines whether the user may use the F2 key. + /// + public bool AllowF2 { get; set; } + + /// + /// Determines whether the user may use the F3 key. + /// + public bool AllowF3 { get; set; } + + /// + /// Determines whether the user may use the F4 key. + /// + public bool AllowF4 { get; set; } + /// /// Determines whether the user may use the F5 key. /// public bool AllowF5 { get; set; } + + /// + /// Determines whether the user may use the F6 key. + /// + public bool AllowF6 { get; set; } + + /// + /// Determines whether the user may use the F7 key. + /// + public bool AllowF7 { get; set; } + + /// + /// Determines whether the user may use the F8 key. + /// + public bool AllowF8 { get; set; } + + /// + /// Determines whether the user may use the F9 key. + /// + public bool AllowF9 { get; set; } + + /// + /// Determines whether the user may use the F10 key. + /// + public bool AllowF10 { get; set; } + + /// + /// Determines whether the user may use the F11 key. + /// + public bool AllowF11 { get; set; } + + /// + /// Determines whether the user may use the F12 key. + /// + public bool AllowF12 { get; set; } + + /// + /// Determines whether the user may use the print screen key. + /// + public bool AllowPrintScreen { get; set; } + + /// + /// Determines whether the user may use the system key. + /// + public bool AllowSystemKey { get; set; } } } diff --git a/SafeExamBrowser.Monitoring/Keyboard/KeyboardInterceptor.cs b/SafeExamBrowser.Monitoring/Keyboard/KeyboardInterceptor.cs index 58816ea1..4b0a10a6 100644 --- a/SafeExamBrowser.Monitoring/Keyboard/KeyboardInterceptor.cs +++ b/SafeExamBrowser.Monitoring/Keyboard/KeyboardInterceptor.cs @@ -32,28 +32,27 @@ namespace SafeExamBrowser.Monitoring.Keyboard var key = KeyInterop.KeyFromVirtualKey(keyCode); block |= key == Key.Apps; - block |= key == Key.F1; - block |= key == Key.F2; - block |= key == Key.F3; - block |= key == Key.F4; - block |= key == Key.F6; - block |= key == Key.F7; - block |= key == Key.F8; - block |= key == Key.F9; - block |= key == Key.F10; - block |= key == Key.F11; - block |= key == Key.F12; - block |= key == Key.LWin; - block |= key == Key.PrintScreen; - block |= key == Key.RWin; - - block |= key == Key.Escape && modifier.HasFlag(KeyModifier.Alt); - block |= key == Key.Escape && modifier.HasFlag(KeyModifier.Ctrl); - block |= key == Key.Space && modifier.HasFlag(KeyModifier.Alt); - - block |= !settings.AllowAltTab && key == Key.Tab && modifier.HasFlag(KeyModifier.Alt); - block |= !settings.AllowEsc && key == Key.Escape && modifier == KeyModifier.None; - block |= !settings.AllowF5 && key == Key.F5; + block |= key == Key.Escape && modifier == KeyModifier.None && !settings.AllowEsc; + block |= key == Key.F1 && !settings.AllowF1; + block |= key == Key.F2 && !settings.AllowF2; + block |= key == Key.F3 && !settings.AllowF3; + block |= key == Key.F4 && !settings.AllowF4; + block |= key == Key.F5 && !settings.AllowF5; + block |= key == Key.F6 && !settings.AllowF6; + block |= key == Key.F7 && !settings.AllowF7; + block |= key == Key.F8 && !settings.AllowF8; + block |= key == Key.F9 && !settings.AllowF9; + block |= key == Key.F10 && !settings.AllowF10; + block |= key == Key.F11 && !settings.AllowF11; + block |= key == Key.F12 && !settings.AllowF12; + block |= key == Key.LWin && !settings.AllowSystemKey; + block |= key == Key.PrintScreen && !settings.AllowPrintScreen; + block |= key == Key.RWin && !settings.AllowSystemKey; + block |= modifier.HasFlag(KeyModifier.Alt) && key == Key.Escape && !settings.AllowAltEsc; + block |= modifier.HasFlag(KeyModifier.Alt) && key == Key.F4 && !settings.AllowAltF4; + block |= modifier.HasFlag(KeyModifier.Alt) && key == Key.Space; + block |= modifier.HasFlag(KeyModifier.Alt) && key == Key.Tab && !settings.AllowAltTab; + block |= modifier.HasFlag(KeyModifier.Ctrl) && key == Key.Escape && !settings.AllowCtrlEsc; if (block) { diff --git a/SafeExamBrowser.Monitoring/Mouse/MouseInterceptor.cs b/SafeExamBrowser.Monitoring/Mouse/MouseInterceptor.cs index 2ce9e575..d019c582 100644 --- a/SafeExamBrowser.Monitoring/Mouse/MouseInterceptor.cs +++ b/SafeExamBrowser.Monitoring/Mouse/MouseInterceptor.cs @@ -27,8 +27,8 @@ namespace SafeExamBrowser.Monitoring.Mouse { var block = false; - block |= !settings.AllowMiddleButton && button == MouseButton.Middle; - block |= !settings.AllowRightButton && button == MouseButton.Right; + block |= button == MouseButton.Middle && !settings.AllowMiddleButton; + block |= button == MouseButton.Right && !settings.AllowRightButton; if (block) { diff --git a/SafeExamBrowser.UserInterface.Classic/AboutWindow.xaml b/SafeExamBrowser.UserInterface.Classic/AboutWindow.xaml index ec76c581..b54b17bc 100644 --- a/SafeExamBrowser.UserInterface.Classic/AboutWindow.xaml +++ b/SafeExamBrowser.UserInterface.Classic/AboutWindow.xaml @@ -5,7 +5,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:SafeExamBrowser.UserInterface.Classic" mc:Ignorable="d" - Title="Version & License Information" Background="White" Height="325" Width="600" ResizeMode="NoResize" Icon="./Images/SafeExamBrowser.ico" + Title="Version & License Information" Background="White" Height="325" Width="575" ResizeMode="NoResize" Icon="./Images/SafeExamBrowser.ico" ShowInTaskbar="False" WindowStartupLocation="CenterScreen"> @@ -17,11 +17,11 @@ - + - This application is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed - with this application, You can obtain one at http://mozilla.org/MPL/2.0/. + This application is subject to the terms of the Mozilla Public License, version 2.0. If a copy of the MPL was not + distributed with this application, you can obtain one at http://mozilla.org/MPL/2.0/. CefSharp (.NET bindings for the Chromium Embedded Framework)