namespace HistoryUI.Views;
///
/// Interaction logic for MainWindow.xaml
///
public partial class MainWindow : Window
{
public MainWindow(IEventAggregator eventAggregator)
{
InitializeComponent();
eventAggregator.GetEvent().Subscribe(InitFinisheEvent);
Loaded += MainWindow_Loaded;
}
private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
this.DragMove();
}
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
this.Content = new Loading();
}
private void InitFinisheEvent()
{
Application.Current.Dispatcher.Invoke(() =>
{
this.SizeToContent = SizeToContent.Manual;
this.WindowState = System.Windows.WindowState.Normal;
this.WindowStyle = System.Windows.WindowStyle.None;
this.ResizeMode = System.Windows.ResizeMode.NoResize;
this.Topmost = true;
if (StartSetting.ResolutionVertical != 0)
{
this.Left = StartSetting.StartPixHorizontal;
this.Top = StartSetting.StartPixVertical;
this.Width = StartSetting.ResolutionHorizontal;
this.Height = StartSetting.ResolutionVertical;
}
else
{
//this.Left = -1920;
//this.Top = 0;
//this.Width = System.Windows.SystemParameters.PrimaryScreenWidth;
//this.Height = System.Windows.SystemParameters.PrimaryScreenHeight;
this.Left = -1024;
this.Top = 0.0;
this.Width = 1024;
this.Height = 768;
}
this.Content = StartSetting.Content switch
{
"1" => new Status(),
"2" => new Alarm(),
"3" => new LogTrace(),
_ => new Status(),
};
});
}
private void Window_Closed(object sender, EventArgs e)
{
}
}