mirror of
https://github.com/hawkeye-stan/msfs-popout-panel-manager.git
synced 2024-11-22 13:50:14 +00:00
49 lines
1.4 KiB
C#
49 lines
1.4 KiB
C#
using Microsoft.Extensions.DependencyInjection;
|
|
using MSFSPopoutPanelManager.MainApp.ViewModel;
|
|
using System;
|
|
using System.Windows;
|
|
using System.Windows.Input;
|
|
using System.Windows.Interop;
|
|
|
|
namespace MSFSPopoutPanelManager.MainApp
|
|
{
|
|
public partial class HudBar : Window
|
|
{
|
|
private HudBarViewModel _viewModel;
|
|
|
|
public HudBar(Guid panelId)
|
|
{
|
|
_viewModel = App.AppHost.Services.GetRequiredService<HudBarViewModel>();
|
|
_viewModel.PanelId = panelId;
|
|
|
|
InitializeComponent();
|
|
Loaded += (sender, e) =>
|
|
{
|
|
DataContext = _viewModel;
|
|
_viewModel.PanelConfig.PanelHandle = new WindowInteropHelper(Window.GetWindow(this)).Handle;
|
|
_viewModel.PanelConfig.Width = Convert.ToInt32(Width);
|
|
_viewModel.PanelConfig.Height = Convert.ToInt32(Height);
|
|
};
|
|
|
|
this.MouseLeftButtonDown += HudBar_MouseLeftButtonDown;
|
|
this.Topmost = true;
|
|
|
|
Closing += HudBar_Closing;
|
|
}
|
|
|
|
private void HudBar_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
|
{
|
|
_viewModel.CloseCommand.Execute(null);
|
|
}
|
|
|
|
private void HudBar_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
|
{
|
|
DragMove();
|
|
}
|
|
|
|
private void BtnClose_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
}
|
|
}
|