2017-07-24 15:29:17 +02:00
|
|
|
|
/*
|
|
|
|
|
* 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.Behaviour;
|
|
|
|
|
using SafeExamBrowser.Contracts.I18n;
|
|
|
|
|
using SafeExamBrowser.Contracts.Logging;
|
|
|
|
|
using SafeExamBrowser.Contracts.UserInterface;
|
|
|
|
|
|
|
|
|
|
namespace SafeExamBrowser.Core.Behaviour.Operations
|
|
|
|
|
{
|
2017-07-26 14:36:20 +02:00
|
|
|
|
public class EventControllerOperation : IOperation
|
2017-07-24 15:29:17 +02:00
|
|
|
|
{
|
|
|
|
|
private ILogger logger;
|
2017-07-26 14:36:20 +02:00
|
|
|
|
private IEventController controller;
|
2017-07-24 15:29:17 +02:00
|
|
|
|
|
|
|
|
|
public ISplashScreen SplashScreen { private get; set; }
|
|
|
|
|
|
2017-07-26 14:36:20 +02:00
|
|
|
|
public EventControllerOperation(IEventController 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...");
|
|
|
|
|
SplashScreen.UpdateText(Key.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...");
|
|
|
|
|
SplashScreen.UpdateText(Key.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
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|