seb-win-refactoring/SafeExamBrowser.UserInterface.Desktop/Controls/ActionCenter/NotificationButton.xaml.cs
2021-02-03 00:45:33 +01:00

41 lines
1.2 KiB
C#

/*
* Copyright (c) 2021 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 System.Windows;
using System.Windows.Controls;
using SafeExamBrowser.Client.Contracts;
using SafeExamBrowser.UserInterface.Contracts.Shell;
using SafeExamBrowser.UserInterface.Shared.Utilities;
namespace SafeExamBrowser.UserInterface.Desktop.Controls.ActionCenter
{
internal partial class NotificationButton : UserControl, INotificationControl
{
private INotificationController controller;
internal NotificationButton(INotificationController controller, INotificationInfo info)
{
this.controller = controller;
InitializeComponent();
InitializeNotificationIcon(info);
}
private void IconButton_Click(object sender, RoutedEventArgs e)
{
controller.Activate();
}
private void InitializeNotificationIcon(INotificationInfo info)
{
Icon.Content = IconResourceLoader.Load(info.IconResource);
IconButton.ToolTip = info.Tooltip;
Text.Text = info.Tooltip;
}
}
}