2017-08-07 12:23:56 +02:00
|
|
|
|
/*
|
2021-02-03 00:45:33 +01:00
|
|
|
|
* Copyright (c) 2021 ETH Zürich, Educational Development and Technology (LET)
|
2017-08-07 12:23:56 +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.Client.Contracts;
|
|
|
|
|
using SafeExamBrowser.Logging.Contracts;
|
|
|
|
|
using SafeExamBrowser.UserInterface.Contracts;
|
|
|
|
|
using SafeExamBrowser.UserInterface.Contracts.Windows;
|
2017-08-07 12:23:56 +02:00
|
|
|
|
|
2018-01-18 08:16:20 +01:00
|
|
|
|
namespace SafeExamBrowser.Client.Notifications
|
2017-08-07 12:23:56 +02:00
|
|
|
|
{
|
2018-01-18 08:16:20 +01:00
|
|
|
|
internal class LogNotificationController : INotificationController
|
2017-08-07 12:23:56 +02:00
|
|
|
|
{
|
|
|
|
|
private ILogger logger;
|
|
|
|
|
private IUserInterfaceFactory uiFactory;
|
|
|
|
|
private IWindow window;
|
|
|
|
|
|
2018-02-07 13:25:49 +01:00
|
|
|
|
public LogNotificationController(ILogger logger, IUserInterfaceFactory uiFactory)
|
2017-08-07 12:23:56 +02:00
|
|
|
|
{
|
|
|
|
|
this.logger = logger;
|
|
|
|
|
this.uiFactory = uiFactory;
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-04 14:11:19 +02:00
|
|
|
|
public void Activate()
|
2017-08-07 12:23:56 +02:00
|
|
|
|
{
|
2019-09-04 14:11:19 +02:00
|
|
|
|
if (window == default(IWindow))
|
2017-08-07 12:23:56 +02:00
|
|
|
|
{
|
2018-02-07 13:25:49 +01:00
|
|
|
|
window = uiFactory.CreateLogWindow(logger);
|
2017-08-07 12:23:56 +02:00
|
|
|
|
|
|
|
|
|
window.Closing += () => window = null;
|
|
|
|
|
window.Show();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
window.BringToForeground();
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-09-04 14:11:19 +02:00
|
|
|
|
|
|
|
|
|
public void Terminate()
|
|
|
|
|
{
|
|
|
|
|
window?.Close();
|
|
|
|
|
}
|
2017-08-07 12:23:56 +02:00
|
|
|
|
}
|
|
|
|
|
}
|