2017-07-24 15:29:17 +02:00
|
|
|
|
/*
|
2018-01-16 08:24:00 +01:00
|
|
|
|
* Copyright (c) 2018 ETH Zürich, Educational Development and Technology (LET)
|
2017-07-24 15:29:17 +02:00
|
|
|
|
*
|
|
|
|
|
* 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.Behaviour;
|
|
|
|
|
using SafeExamBrowser.Contracts.I18n;
|
|
|
|
|
using SafeExamBrowser.Contracts.Logging;
|
2018-01-17 08:26:44 +01:00
|
|
|
|
using SafeExamBrowser.Contracts.Runtime;
|
2017-07-24 15:29:17 +02:00
|
|
|
|
using SafeExamBrowser.Contracts.UserInterface;
|
|
|
|
|
|
2018-01-18 08:16:20 +01:00
|
|
|
|
namespace SafeExamBrowser.Runtime.Behaviour.Operations
|
2017-07-24 15:29:17 +02:00
|
|
|
|
{
|
2018-01-18 08:16:20 +01:00
|
|
|
|
internal class RuntimeControllerOperation : IOperation
|
2017-07-24 15:29:17 +02:00
|
|
|
|
{
|
|
|
|
|
private ILogger logger;
|
2017-08-02 14:01:20 +02:00
|
|
|
|
private IRuntimeController controller;
|
2017-07-24 15:29:17 +02:00
|
|
|
|
|
|
|
|
|
public ISplashScreen SplashScreen { private get; set; }
|
|
|
|
|
|
2017-08-07 09:42:12 +02:00
|
|
|
|
public RuntimeControllerOperation(IRuntimeController controller, ILogger logger)
|
2017-07-24 15:29:17 +02:00
|
|
|
|
{
|
2017-07-26 14:36:20 +02:00
|
|
|
|
this.controller = controller;
|
2017-07-24 15:29:17 +02:00
|
|
|
|
this.logger = logger;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Perform()
|
|
|
|
|
{
|
2017-07-26 14:36:20 +02:00
|
|
|
|
logger.Info("Starting event handling...");
|
2017-08-03 15:35:22 +02:00
|
|
|
|
SplashScreen.UpdateText(TextKey.SplashScreen_StartEventHandling);
|
2017-07-24 15:29:17 +02:00
|
|
|
|
|
2017-07-26 14:36:20 +02:00
|
|
|
|
controller.Start();
|
2017-07-24 15:29:17 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Revert()
|
|
|
|
|
{
|
2017-07-26 14:36:20 +02:00
|
|
|
|
logger.Info("Stopping event handling...");
|
2017-08-03 15:35:22 +02:00
|
|
|
|
SplashScreen.UpdateText(TextKey.SplashScreen_StopEventHandling);
|
2017-07-24 15:29:17 +02:00
|
|
|
|
|
2017-07-26 14:36:20 +02:00
|
|
|
|
controller.Stop();
|
2017-07-24 15:29:17 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|