seb-win-refactoring/SafeExamBrowser.Client/Notifications/AboutNotificationController.cs

49 lines
1.2 KiB
C#
Raw Normal View History

2017-08-02 10:13:23 +02:00
/*
2021-02-03 00:45:33 +01:00
* Copyright (c) 2021 ETH Zürich, Educational Development and Technology (LET)
2017-08-02 10:13:23 +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.Client.Contracts;
using SafeExamBrowser.Configuration.Contracts;
using SafeExamBrowser.UserInterface.Contracts;
using SafeExamBrowser.UserInterface.Contracts.Windows;
2017-08-02 10:13:23 +02:00
namespace SafeExamBrowser.Client.Notifications
2017-08-02 10:13:23 +02:00
{
internal class AboutNotificationController : INotificationController
2017-08-02 10:13:23 +02:00
{
private AppConfig appConfig;
2017-08-02 10:13:23 +02:00
private IUserInterfaceFactory uiFactory;
private IWindow window;
public AboutNotificationController(AppConfig appConfig, IUserInterfaceFactory uiFactory)
2017-08-02 10:13:23 +02:00
{
this.appConfig = appConfig;
2017-08-02 10:13:23 +02:00
this.uiFactory = uiFactory;
}
public void Activate()
2017-08-02 10:13:23 +02:00
{
if (window == default(IWindow))
2017-08-02 10:13:23 +02:00
{
window = uiFactory.CreateAboutWindow(appConfig);
2017-08-02 10:13:23 +02:00
window.Closing += () => window = default(IWindow);
2017-08-02 10:13:23 +02:00
window.Show();
}
else
{
window.BringToForeground();
}
}
public void Terminate()
{
window?.Close();
}
2017-08-02 10:13:23 +02:00
}
}