MainWindow.xaml.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. default:
  63. break;
  64. }
  65. }
  66. }