mirror of
https://github.com/hawkeye-stan/msfs-popout-panel-manager.git
synced 2024-11-24 23:00:12 +00:00
32 lines
1.1 KiB
C#
32 lines
1.1 KiB
C#
|
using Microsoft.Extensions.DependencyInjection;
|
|||
|
using MSFSPopoutPanelManager.MainApp.ViewModel;
|
|||
|
using Prism.Commands;
|
|||
|
using System;
|
|||
|
using System.Windows;
|
|||
|
using System.Windows.Controls;
|
|||
|
|
|||
|
namespace MSFSPopoutPanelManager.MainApp
|
|||
|
{
|
|||
|
public partial class TrayIcon : UserControl
|
|||
|
{
|
|||
|
// This command has to be here since it doesn't work in view model, window StateChanged never gets fire
|
|||
|
public DelegateCommand RestoreWindowCommand => new DelegateCommand(() => { ((Window)((Border)((Grid)this.Parent).Parent).Parent).WindowState = WindowState.Normal; }, () => { return true; });
|
|||
|
|
|||
|
private TrayIconViewModel ViewModel { get; set; }
|
|||
|
|
|||
|
public TrayIcon()
|
|||
|
{
|
|||
|
ViewModel = App.AppHost.Services.GetRequiredService<TrayIconViewModel>();
|
|||
|
InitializeComponent();
|
|||
|
Loaded += (sender, e) => { DataContext = ViewModel; };
|
|||
|
|
|||
|
Tray.DoubleClickCommand = RestoreWindowCommand;
|
|||
|
}
|
|||
|
|
|||
|
private void MenuItem_Click(object sender, RoutedEventArgs e)
|
|||
|
{
|
|||
|
Tray.ContextMenu.IsOpen = true;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|