2018-01-26 12:33:36 +01:00
|
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2018 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/.
|
|
|
|
|
*/
|
|
|
|
|
|
2018-02-01 08:37:12 +01:00
|
|
|
|
using SafeExamBrowser.Contracts.Behaviour.Operations;
|
2018-02-06 15:12:11 +01:00
|
|
|
|
using SafeExamBrowser.Contracts.Configuration;
|
2018-01-30 14:41:36 +01:00
|
|
|
|
using SafeExamBrowser.Contracts.Configuration.Settings;
|
|
|
|
|
using SafeExamBrowser.Contracts.I18n;
|
|
|
|
|
using SafeExamBrowser.Contracts.Logging;
|
2018-01-26 12:33:36 +01:00
|
|
|
|
using SafeExamBrowser.Contracts.UserInterface;
|
|
|
|
|
|
|
|
|
|
namespace SafeExamBrowser.Runtime.Behaviour.Operations
|
|
|
|
|
{
|
|
|
|
|
internal class KioskModeOperation : IOperation
|
|
|
|
|
{
|
2018-01-30 14:41:36 +01:00
|
|
|
|
private ILogger logger;
|
2018-02-06 15:12:11 +01:00
|
|
|
|
private IConfigurationRepository configuration;
|
2018-01-30 14:41:36 +01:00
|
|
|
|
private KioskMode kioskMode;
|
|
|
|
|
|
2018-02-01 08:37:12 +01:00
|
|
|
|
public bool Abort { get; private set; }
|
2018-02-02 09:18:35 +01:00
|
|
|
|
public IProgressIndicator ProgressIndicator { private get; set; }
|
2018-01-26 12:33:36 +01:00
|
|
|
|
|
2018-02-06 15:12:11 +01:00
|
|
|
|
public KioskModeOperation(ILogger logger, IConfigurationRepository configuration)
|
2018-01-30 14:41:36 +01:00
|
|
|
|
{
|
|
|
|
|
this.logger = logger;
|
2018-02-06 15:12:11 +01:00
|
|
|
|
this.configuration = configuration;
|
2018-01-30 14:41:36 +01:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-26 12:33:36 +01:00
|
|
|
|
public void Perform()
|
|
|
|
|
{
|
2018-02-06 15:12:11 +01:00
|
|
|
|
kioskMode = configuration.CurrentSettings.KioskMode;
|
2018-01-30 14:41:36 +01:00
|
|
|
|
|
|
|
|
|
logger.Info($"Initializing kiosk mode '{kioskMode}'...");
|
2018-02-02 09:30:41 +01:00
|
|
|
|
ProgressIndicator?.UpdateText(TextKey.ProgressIndicator_InitializeKioskMode);
|
2018-01-30 14:41:36 +01:00
|
|
|
|
|
2018-02-14 15:26:05 +01:00
|
|
|
|
switch (kioskMode)
|
2018-01-30 14:41:36 +01:00
|
|
|
|
{
|
2018-02-14 15:26:05 +01:00
|
|
|
|
case KioskMode.CreateNewDesktop:
|
|
|
|
|
CreateNewDesktop();
|
|
|
|
|
break;
|
|
|
|
|
case KioskMode.DisableExplorerShell:
|
|
|
|
|
DisableExplorerShell();
|
|
|
|
|
break;
|
2018-01-30 14:41:36 +01:00
|
|
|
|
}
|
2018-01-26 12:33:36 +01:00
|
|
|
|
}
|
|
|
|
|
|
2018-02-01 08:37:12 +01:00
|
|
|
|
public void Repeat()
|
|
|
|
|
{
|
2018-02-28 09:45:29 +01:00
|
|
|
|
// TODO: Depends on new kiosk mode!
|
2018-02-01 08:37:12 +01:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-26 12:33:36 +01:00
|
|
|
|
public void Revert()
|
|
|
|
|
{
|
2018-01-30 14:41:36 +01:00
|
|
|
|
logger.Info($"Reverting kiosk mode '{kioskMode}'...");
|
2018-02-02 09:30:41 +01:00
|
|
|
|
ProgressIndicator?.UpdateText(TextKey.ProgressIndicator_RevertKioskMode);
|
2018-01-30 14:41:36 +01:00
|
|
|
|
|
2018-02-14 15:26:05 +01:00
|
|
|
|
switch (kioskMode)
|
2018-01-30 14:41:36 +01:00
|
|
|
|
{
|
2018-02-14 15:26:05 +01:00
|
|
|
|
case KioskMode.CreateNewDesktop:
|
|
|
|
|
CloseNewDesktop();
|
|
|
|
|
break;
|
|
|
|
|
case KioskMode.DisableExplorerShell:
|
|
|
|
|
RestartExplorerShell();
|
|
|
|
|
break;
|
2018-01-30 14:41:36 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void CreateNewDesktop()
|
|
|
|
|
{
|
2018-02-01 08:37:12 +01:00
|
|
|
|
// TODO
|
2018-01-30 14:41:36 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void CloseNewDesktop()
|
|
|
|
|
{
|
2018-02-01 08:37:12 +01:00
|
|
|
|
// TODO
|
2018-01-30 14:41:36 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void DisableExplorerShell()
|
|
|
|
|
{
|
2018-02-01 08:37:12 +01:00
|
|
|
|
// TODO
|
2018-01-30 14:41:36 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void RestartExplorerShell()
|
|
|
|
|
{
|
2018-02-01 08:37:12 +01:00
|
|
|
|
// TODO
|
2018-01-26 12:33:36 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|