2017-08-22 10:29:00 +02:00
|
|
|
|
/*
|
2019-01-09 11:25:21 +01:00
|
|
|
|
* Copyright (c) 2019 ETH Zürich, Educational Development and Technology (LET)
|
2017-08-22 10:29:00 +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 System.Windows;
|
|
|
|
|
using System.Windows.Controls;
|
2018-08-31 10:06:27 +02:00
|
|
|
|
using SafeExamBrowser.Contracts.Core;
|
2017-08-22 10:29:00 +02:00
|
|
|
|
using SafeExamBrowser.Contracts.Configuration;
|
2018-08-31 07:49:41 +02:00
|
|
|
|
using SafeExamBrowser.Contracts.UserInterface.Taskbar.Events;
|
2019-01-11 15:32:47 +01:00
|
|
|
|
using SafeExamBrowser.UserInterface.Desktop.Utilities;
|
2017-08-22 10:29:00 +02:00
|
|
|
|
|
2019-01-11 15:32:47 +01:00
|
|
|
|
namespace SafeExamBrowser.UserInterface.Desktop.Controls
|
2017-08-22 10:29:00 +02:00
|
|
|
|
{
|
|
|
|
|
public partial class ApplicationInstanceButton : UserControl
|
|
|
|
|
{
|
|
|
|
|
private IApplicationInfo info;
|
|
|
|
|
private IApplicationInstance instance;
|
|
|
|
|
|
2018-08-31 07:49:41 +02:00
|
|
|
|
internal event ApplicationButtonClickedEventHandler Clicked;
|
2017-08-22 10:29:00 +02:00
|
|
|
|
|
|
|
|
|
public ApplicationInstanceButton(IApplicationInstance instance, IApplicationInfo info)
|
|
|
|
|
{
|
|
|
|
|
this.info = info;
|
|
|
|
|
this.instance = instance;
|
|
|
|
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
InitializeApplicationInstanceButton();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void InitializeApplicationInstanceButton()
|
|
|
|
|
{
|
|
|
|
|
Icon.Content = IconResourceLoader.Load(info.IconResource);
|
|
|
|
|
Text.Text = instance.Name;
|
|
|
|
|
Button.ToolTip = instance.Name;
|
|
|
|
|
|
|
|
|
|
instance.NameChanged += (name) =>
|
|
|
|
|
{
|
|
|
|
|
Dispatcher.Invoke(() =>
|
|
|
|
|
{
|
|
|
|
|
Text.Text = name;
|
|
|
|
|
Button.ToolTip = name;
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Button_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Clicked?.Invoke(instance.Id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|