SEBWIN-112, SEBWIN-113: Implemented data value mapping for keyboard and mouse configuration.
This commit is contained in:
parent
4edd8480ef
commit
7c58c10b86
14 changed files with 476 additions and 97 deletions
|
@ -87,7 +87,7 @@ namespace SafeExamBrowser.Client.UnitTests.Operations
|
|||
powerSupplyMock.Verify(p => p.Initialize(It.IsAny<ISystemPowerSupplyControl>()), Times.Once);
|
||||
wirelessNetworkMock.Verify(w => w.Initialize(It.IsAny<ISystemWirelessNetworkControl>()), Times.Once);
|
||||
taskbarMock.Verify(t => t.AddSystemControl(It.IsAny<ISystemControl>()), Times.Exactly(3));
|
||||
taskbarMock.Verify(t => t.AddNotification(It.IsAny<INotificationButton>()), Times.Once);
|
||||
taskbarMock.Verify(t => t.AddNotification(It.IsAny<INotificationButton>()), 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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<string, object> data)
|
||||
internal void ExtractAndImportIdentities(IDictionary<string, object> data)
|
||||
{
|
||||
const int IDENTITY_CERTIFICATE = 1;
|
||||
var hasCertificates = data.TryGetValue(Keys.Network.Certificates.EmbeddedCertificates, out var value);
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,7 +11,7 @@ using SafeExamBrowser.Contracts.Configuration.Settings;
|
|||
|
||||
namespace SafeExamBrowser.Configuration.ConfigurationData
|
||||
{
|
||||
internal class DataMapper
|
||||
internal partial class DataMapper
|
||||
{
|
||||
internal void MapRawDataToSettings(IDictionary<string, object> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace SafeExamBrowser.Configuration
|
|||
{
|
||||
public class ConfigurationRepository : IConfigurationRepository
|
||||
{
|
||||
private Certificates certificates;
|
||||
private CertificateImporter certificateImporter;
|
||||
private IList<IDataParser> dataParsers;
|
||||
private IList<IDataSerializer> 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<IDataParser>();
|
||||
dataSerializers = new List<IDataSerializer>();
|
||||
dataMapper = new DataMapper();
|
||||
dataValues = new DataValues(executablePath, programCopyright, programTitle, programVersion);
|
||||
resourceLoaders = new List<IResourceLoader>();
|
||||
resourceSavers = new List<IResourceSaver>();
|
||||
|
||||
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);
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
<Reference Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ConfigurationData\Certificates.cs" />
|
||||
<Compile Include="ConfigurationData\CertificateImporter.cs" />
|
||||
<Compile Include="ConfigurationData\Keys.cs" />
|
||||
<Compile Include="ConfigurationData\DataValues.cs" />
|
||||
<Compile Include="DataCompression\GZipCompressor.cs" />
|
||||
|
@ -69,6 +69,15 @@
|
|||
<Compile Include="DataFormats\BinarySerializer.cs" />
|
||||
<Compile Include="DataFormats\BinaryBlock.cs" />
|
||||
<Compile Include="ConfigurationData\DataMapper.cs" />
|
||||
<Compile Include="ConfigurationData\DataMapper.ConfigurationFile.cs">
|
||||
<DependentUpon>DataMapper.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ConfigurationData\DataMapper.General.cs">
|
||||
<DependentUpon>DataMapper.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ConfigurationData\DataMapper.Input.cs">
|
||||
<DependentUpon>DataMapper.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Cryptography\HashAlgorithm.cs" />
|
||||
<Compile Include="DataFormats\XmlElement.cs" />
|
||||
<Compile Include="DataFormats\XmlParser.cs" />
|
||||
|
|
|
@ -16,19 +16,99 @@ namespace SafeExamBrowser.Contracts.Configuration.Settings
|
|||
[Serializable]
|
||||
public class KeyboardSettings
|
||||
{
|
||||
/// <summary>
|
||||
/// Determines whether the user may use the ALT+ESC shortcut.
|
||||
/// </summary>
|
||||
public bool AllowAltEsc { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the user may use the ALT+F4 shortcut.
|
||||
/// </summary>
|
||||
public bool AllowAltF4 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the user may use the ALT+TAB shortcut.
|
||||
/// </summary>
|
||||
public bool AllowAltTab { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the user may use the CTRL+ESC shortcut.
|
||||
/// </summary>
|
||||
public bool AllowCtrlEsc { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the user may use the escape key.
|
||||
/// </summary>
|
||||
public bool AllowEsc { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the user may use the F1 key.
|
||||
/// </summary>
|
||||
public bool AllowF1 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the user may use the F2 key.
|
||||
/// </summary>
|
||||
public bool AllowF2 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the user may use the F3 key.
|
||||
/// </summary>
|
||||
public bool AllowF3 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the user may use the F4 key.
|
||||
/// </summary>
|
||||
public bool AllowF4 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the user may use the F5 key.
|
||||
/// </summary>
|
||||
public bool AllowF5 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the user may use the F6 key.
|
||||
/// </summary>
|
||||
public bool AllowF6 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the user may use the F7 key.
|
||||
/// </summary>
|
||||
public bool AllowF7 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the user may use the F8 key.
|
||||
/// </summary>
|
||||
public bool AllowF8 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the user may use the F9 key.
|
||||
/// </summary>
|
||||
public bool AllowF9 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the user may use the F10 key.
|
||||
/// </summary>
|
||||
public bool AllowF10 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the user may use the F11 key.
|
||||
/// </summary>
|
||||
public bool AllowF11 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the user may use the F12 key.
|
||||
/// </summary>
|
||||
public bool AllowF12 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the user may use the print screen key.
|
||||
/// </summary>
|
||||
public bool AllowPrintScreen { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the user may use the system key.
|
||||
/// </summary>
|
||||
public bool AllowSystemKey { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
|
@ -17,11 +17,11 @@
|
|||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image Grid.ColumnSpan="2" Source="pack://application:,,,/SafeExamBrowser.UserInterface.Classic;component/Images/SplashScreen.png" Margin="0,5,0,0" />
|
||||
<TextBlock x:Name="VersionInfo" Grid.Row="0" Grid.Column="1" Foreground="Gray" Margin="25,75,125,10" TextWrapping="Wrap" />
|
||||
<TextBlock x:Name="VersionInfo" Grid.Row="0" Grid.Column="1" Foreground="Gray" Margin="25,75,100,10" TextWrapping="Wrap" />
|
||||
<ScrollViewer Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" VerticalScrollBarVisibility="Auto">
|
||||
<TextBlock x:Name="MainText" Margin="10" FontSize="10" TextWrapping="Wrap">
|
||||
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/.
|
||||
<LineBreak />
|
||||
<LineBreak />
|
||||
<Bold><Underline>CefSharp (.NET bindings for the Chromium Embedded Framework)</Underline></Bold>
|
||||
|
|
Loading…
Reference in a new issue