MainWindow.xaml.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. namespace HistoryUI.Views;
  2. /// <summary>
  3. /// Interaction logic for MainWindow.xaml
  4. /// </summary>
  5. public partial class MainWindow : Window
  6. {
  7. public MainWindow(IEventAggregator eventAggregator)
  8. {
  9. InitializeComponent();
  10. eventAggregator.GetEvent<InitFinish>().Subscribe(InitFinisheEvent);
  11. Loaded += MainWindow_Loaded;
  12. }
  13. private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
  14. {
  15. this.DragMove();
  16. }
  17. private void MainWindow_Loaded(object sender, RoutedEventArgs e)
  18. {
  19. this.Content = new Loading();
  20. }
  21. private void InitFinisheEvent()
  22. {
  23. Application.Current.Dispatcher.Invoke(() =>
  24. {
  25. this.SizeToContent = SizeToContent.Manual;
  26. this.WindowState = System.Windows.WindowState.Normal;
  27. this.WindowStyle = System.Windows.WindowStyle.None;
  28. this.ResizeMode = System.Windows.ResizeMode.NoResize;
  29. this.Topmost = true;
  30. if (StartSetting.ResolutionVertical != 0)
  31. {
  32. this.Left = StartSetting.StartPixHorizontal;
  33. this.Top = StartSetting.StartPixVertical;
  34. this.Width = StartSetting.ResolutionHorizontal;
  35. this.Height = StartSetting.ResolutionVertical;
  36. }
  37. else
  38. {
  39. //this.Left = -1920;
  40. //this.Top = 0;
  41. //this.Width = System.Windows.SystemParameters.PrimaryScreenWidth;
  42. //this.Height = System.Windows.SystemParameters.PrimaryScreenHeight;
  43. this.Left = -1024;
  44. this.Top = 0.0;
  45. this.Width = 1024;
  46. this.Height = 768;
  47. }
  48. this.Content = StartSetting.Content switch
  49. {
  50. "1" => new Status(),
  51. "2" => new Alarm(),
  52. "3" => new LogTrace(),
  53. _ => new Status(),
  54. };
  55. });
  56. }
  57. private void Window_Closed(object sender, EventArgs e)
  58. {
  59. }
  60. }