2017-10-10 10:17:28 +02:00
|
|
|
|
/*
|
2022-01-21 16:33:52 +01:00
|
|
|
|
* Copyright (c) 2022 ETH Zürich, Educational Development and Technology (LET)
|
2017-10-10 10:17:28 +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/.
|
|
|
|
|
*/
|
|
|
|
|
|
2019-08-30 09:55:26 +02:00
|
|
|
|
using SafeExamBrowser.Core.Contracts.OperationModel;
|
|
|
|
|
using SafeExamBrowser.Core.Contracts.OperationModel.Events;
|
|
|
|
|
using SafeExamBrowser.I18n.Contracts;
|
|
|
|
|
using SafeExamBrowser.Logging.Contracts;
|
2017-10-10 10:17:28 +02:00
|
|
|
|
|
2018-08-31 10:06:27 +02:00
|
|
|
|
namespace SafeExamBrowser.Core.Operations
|
2017-10-10 10:17:28 +02:00
|
|
|
|
{
|
2018-03-06 14:35:10 +01:00
|
|
|
|
/// <summary>
|
2020-03-09 17:35:48 +01:00
|
|
|
|
/// An operation to handle the initialization of an <see cref="IText"/> module with text data.
|
2018-03-06 14:35:10 +01:00
|
|
|
|
/// </summary>
|
2017-10-10 10:17:28 +02:00
|
|
|
|
public class I18nOperation : IOperation
|
|
|
|
|
{
|
|
|
|
|
private ILogger logger;
|
|
|
|
|
private IText text;
|
|
|
|
|
|
2018-10-03 14:35:27 +02:00
|
|
|
|
public event ActionRequiredEventHandler ActionRequired { add { } remove { } }
|
|
|
|
|
public event StatusChangedEventHandler StatusChanged { add { } remove { } }
|
2017-10-10 10:17:28 +02:00
|
|
|
|
|
2020-03-09 17:35:48 +01:00
|
|
|
|
public I18nOperation(ILogger logger, IText text)
|
2017-10-10 10:17:28 +02:00
|
|
|
|
{
|
|
|
|
|
this.logger = logger;
|
|
|
|
|
this.text = text;
|
|
|
|
|
}
|
|
|
|
|
|
2018-02-28 15:49:06 +01:00
|
|
|
|
public OperationResult Perform()
|
2017-10-10 10:17:28 +02:00
|
|
|
|
{
|
2020-03-09 17:35:48 +01:00
|
|
|
|
logger.Info($"Loading text data...");
|
2017-10-10 10:17:28 +02:00
|
|
|
|
|
2020-03-09 17:35:48 +01:00
|
|
|
|
text.Initialize();
|
2018-02-28 15:49:06 +01:00
|
|
|
|
|
|
|
|
|
return OperationResult.Success;
|
2017-10-10 10:17:28 +02:00
|
|
|
|
}
|
|
|
|
|
|
2018-10-10 09:19:03 +02:00
|
|
|
|
public OperationResult Revert()
|
2018-02-01 08:37:12 +01:00
|
|
|
|
{
|
2018-10-10 09:19:03 +02:00
|
|
|
|
return OperationResult.Success;
|
2017-10-10 10:17:28 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|