MainWindow.xaml.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. using Dm.filter;
  2. using ProximaAnalizer.PublicEvent;
  3. using System.Text;
  4. using System.Windows;
  5. using System.Windows.Controls;
  6. using System.Windows.Data;
  7. using System.Windows.Documents;
  8. using System.Windows.Input;
  9. using System.Windows.Media;
  10. using System.Windows.Media.Imaging;
  11. using System.Windows.Navigation;
  12. using System.Windows.Shapes;
  13. namespace ProximaAnalizer.Views;
  14. /// <summary>
  15. /// Interaction logic for MainWindow.xaml
  16. /// </summary>
  17. public partial class MainWindow : Window
  18. {
  19. public MainWindow(IEventAggregator eventAggregator, IRegionManager regionManager)
  20. {
  21. InitializeComponent();
  22. this._eventAggregator = eventAggregator;
  23. this._eventAggregator.GetEvent<WindowSwitch>().Subscribe(SwitchWindow);
  24. this.Loaded += MainWindow_Loaded;
  25. this._regionManager = regionManager;
  26. }
  27. private readonly IRegionManager _regionManager;
  28. private readonly IEventAggregator _eventAggregator;
  29. private void MainWindow_Loaded(object sender, RoutedEventArgs e)
  30. {
  31. this.WindowStyle = WindowStyle.None;
  32. this.ResizeMode = ResizeMode.NoResize;
  33. this.Content = new Loading();
  34. }
  35. private object? Summary;
  36. private object? RecipeNavi;
  37. private void SwitchWindow()
  38. {
  39. switch (this._eventAggregator.GetEvent<WindowSwitch>().Page)
  40. {
  41. case Pages.Loading:
  42. Width = 800;
  43. Height = 160;
  44. break;
  45. case Pages.RecipeStepNavi:
  46. Width = 1280;
  47. Height = 800;
  48. this.WindowStyle = WindowStyle.ThreeDBorderWindow;
  49. this.ResizeMode = ResizeMode.CanResize;
  50. this.RecipeNavi ??= new RecipeStepNavi();
  51. this.Content = this.RecipeNavi;
  52. break;
  53. case Pages.MainWindow:
  54. Width = 1280;
  55. Height = 800;
  56. this.WindowStyle = WindowStyle.ThreeDBorderWindow;
  57. this.ResizeMode = ResizeMode.CanResize;
  58. this.Summary ??= new Summary();
  59. this.Content = this.Summary;
  60. _regionManager.RequestNavigate("MainRegion", "DBInfoTrace");
  61. break;
  62. case Pages.HistoryData:
  63. Width = 1280;
  64. Height = 800;
  65. this.WindowStyle = WindowStyle.ThreeDBorderWindow;
  66. this.ResizeMode = ResizeMode.CanResize;
  67. this.Summary ??= new Summary();
  68. this.Content = this.Summary;
  69. _regionManager.RequestNavigate("MainRegion", "DBInfoAlarm");
  70. break;
  71. default:
  72. break;
  73. }
  74. }
  75. }