2017-08-07 18:08:55 +02:00
|
|
|
|
/*
|
2018-01-16 08:24:00 +01:00
|
|
|
|
* Copyright (c) 2018 ETH Zürich, Educational Development and Technology (LET)
|
2017-08-07 18:08:55 +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;
|
|
|
|
|
using SafeExamBrowser.Contracts.UserInterface;
|
|
|
|
|
using SafeExamBrowser.Contracts.WindowsApi;
|
|
|
|
|
|
2018-01-18 08:16:20 +01:00
|
|
|
|
namespace SafeExamBrowser.Client.Behaviour.Operations
|
2017-08-07 18:08:55 +02:00
|
|
|
|
{
|
2018-01-18 08:16:20 +01:00
|
|
|
|
internal class ClipboardOperation : IOperation
|
2017-08-07 18:08:55 +02:00
|
|
|
|
{
|
|
|
|
|
private ILogger logger;
|
|
|
|
|
private INativeMethods nativeMethods;
|
|
|
|
|
|
2018-01-19 14:04:12 +01:00
|
|
|
|
public bool AbortStartup { get; private set; }
|
2017-08-07 18:08:55 +02:00
|
|
|
|
public ISplashScreen SplashScreen { private get; set; }
|
|
|
|
|
|
|
|
|
|
public ClipboardOperation(ILogger logger, INativeMethods nativeMethods)
|
|
|
|
|
{
|
|
|
|
|
this.logger = logger;
|
|
|
|
|
this.nativeMethods = nativeMethods;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Perform()
|
|
|
|
|
{
|
|
|
|
|
EmptyClipboard();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Revert()
|
|
|
|
|
{
|
|
|
|
|
EmptyClipboard();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void EmptyClipboard()
|
|
|
|
|
{
|
|
|
|
|
logger.Info("Emptying clipboard...");
|
|
|
|
|
SplashScreen.UpdateText(TextKey.SplashScreen_EmptyClipboard);
|
|
|
|
|
|
|
|
|
|
nativeMethods.EmptyClipboard();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|