ShellView.xaml.cs 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. using Prism.Regions;
  2. using System.Collections.Generic;
  3. using System.Windows;
  4. using Venus_Themes.CustomControls;
  5. using Venus_UI.Themes.Attach;
  6. using Venus_Unity;
  7. using System.Linq;
  8. using System.Threading;
  9. using System;
  10. using Venus_MainPages.Views;
  11. using System.Windows.Controls;
  12. using Aitex.Core.UI.View.Frame;
  13. using System.Windows.Media;
  14. using Venus_Core;
  15. using System.Reflection;
  16. using Venus_MainPages.Unity;
  17. using MECF.Framework.Common.DataCenter;
  18. using Aitex.Core.RT.SCCore;
  19. using MECF.Framework.Common.OperationCenter;
  20. namespace Venus_UI.Views
  21. {
  22. /// <summary>
  23. /// ShellView.xaml 的交互逻辑
  24. /// </summary>
  25. public partial class ShellView : Window
  26. {
  27. IRegionManager m_regionManager;
  28. IRegionNavigationService m_regionNavigationService;
  29. List<VenusMenu> VenusMenu;
  30. List<TabControl> centerTabViews=new List<TabControl> ();
  31. List<Button> buttonList=new List<Button> ();
  32. public ShellView(IRegionManager regionManager, IRegionNavigationService regionNavigationService)
  33. {
  34. InitializeComponent();
  35. m_regionManager = regionManager;
  36. m_regionNavigationService = regionNavigationService;
  37. m_regionManager.RegisterViewWithRegion("TopRegion", typeof(Venus_MainPages.Views.TopView));
  38. VenusGlobalEvents.SlotRightClickChangedEvent += Instance_SlotRightClickChangedEvent;
  39. VenusGlobalEvents.SlotWaferTransferEvent += Instance_SlotStartTransferEvent;
  40. }
  41. private void Instance_SlotRightClickChangedEvent(OpenSEMI.Ctrlib.Controls.Slot slot)
  42. {
  43. if (slot != null)
  44. {
  45. ContextMenu cm = ContextMenuManager.Instance.GetSlotMenus(slot);
  46. if (cm != null)
  47. {
  48. slot.ContextMenu = cm;
  49. }
  50. return;
  51. }
  52. }
  53. private void Instance_SlotStartTransferEvent(OpenSEMI.Ctrlib.Controls.DragDropEventArgs e)
  54. {
  55. InvokeClient.Instance.Service.DoOperation("System.MoveWafer",
  56. e.TranferFrom.ModuleID,e.TranferFrom.SlotID, e.TranferTo.ModuleID, e.TranferTo.SlotID,false,1,false,1,"");
  57. e.TranferFrom.ClearDragDropStatus();
  58. e.TranferTo.ClearDragDropStatus();
  59. }
  60. private void CustomWnd_Loaded(object sender, RoutedEventArgs e)
  61. {
  62. VenusMenu = SerializeHelper.Instance.ReadFromJsonFile<List<VenusMenu>>($"Config/UIMenu.json");
  63. int index = 0;
  64. for (int i = 0; i < VenusMenu.Count; i++)
  65. {
  66. if (VenusMenu[i].IsShow == false)
  67. {
  68. continue;
  69. }
  70. string[] allModules = QueryDataClient.Instance.Service.GetConfig($"System.InstalledModules").ToString().Split(',');
  71. if (VenusMenu[i].Id == "PMA" || VenusMenu[i].Id == "PMB" || VenusMenu[i].Id == "PMC" || VenusMenu[i].Id == "PMD")
  72. {
  73. if (!allModules.Contains(VenusMenu[i].Id))
  74. {
  75. continue;
  76. }
  77. }
  78. AduRadioButtonIcon aduRadioButtonIcon = new AduRadioButtonIcon();
  79. if (i == 0)
  80. {
  81. aduRadioButtonIcon.IsChecked = true;
  82. }
  83. IconElement.SetPathData(aduRadioButtonIcon,(Geometry)aduRadioButtonIcon.FindResource($"Icon_{VenusMenu[i].Id}"));
  84. aduRadioButtonIcon.Content = VenusMenu[i].Id;
  85. aduRadioButtonIcon.Click += AduRadioButtonIcon_Click;
  86. aduRadioButtonIcon.SelectBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#6AD7FF"));
  87. aduRadioButtonIcon.SelectColor = new SolidColorBrush((Colors.Black));
  88. aduRadioButtonIcon.DefaultBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#94BCD7"));
  89. //aduRadioButtonIcon.DefaultBackground = new SolidColorBrush(Colors.DarkGray);
  90. aduRadioButtonIcon.Width = 180;
  91. aduRadioButtonIcon.Height= 40;
  92. //aduRadioButtonIcon.Foreground=Brushes.White;
  93. aduRadioButtonIcon.Tag = index;
  94. index += 1;
  95. Bottom_Frame.Children.Add(aduRadioButtonIcon);
  96. //if (VenusMenu[i].Id == "PMC")
  97. //{
  98. // AduRadioButtonIcon aduRadioButtonIcon2 = new AduRadioButtonIcon();
  99. // IconElement.SetPathData(aduRadioButtonIcon2, (Geometry)aduRadioButtonIcon.FindResource($"Icon_{VenusMenu[i].Id}"));
  100. // aduRadioButtonIcon2.Content = "PMD";
  101. // //aduRadioButtonIcon2.Click += AduRadioButtonIcon_Click;
  102. // aduRadioButtonIcon2.SelectBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#6AD7FF"));
  103. // aduRadioButtonIcon2.SelectColor = new SolidColorBrush((Colors.Black));
  104. // aduRadioButtonIcon2.DefaultBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#94BCD7"));
  105. // //aduRadioButtonIcon.DefaultBackground = new SolidColorBrush(Colors.DarkGray);
  106. // aduRadioButtonIcon2.Width = 180;
  107. // aduRadioButtonIcon2.Height = 40;
  108. // Bottom_Frame.Children.Add(aduRadioButtonIcon2);
  109. //}
  110. TabControl tabControl = new TabControl();
  111. for (int j = 0; j < VenusMenu[i].MenuItem.Count; j++)
  112. {
  113. if (VenusMenu[i].MenuItem[j].IsShow == false)
  114. {
  115. continue;
  116. }
  117. string className;
  118. if ((VenusMenu[i].Id == "PMA" || VenusMenu[i].Id == "PMB" || VenusMenu[i].Id == "PMC" || VenusMenu[i].Id == "PMD")&& VenusMenu[i].MenuItem[j].Id== "Operation")
  119. {
  120. JetChamber jetChamber = (JetChamber)(Convert.ToInt32(QueryDataClient.Instance.Service.GetConfig($"{VenusMenu[i].Id}.ChamberType")));
  121. className = $"Venus_MainPages.Views.Over{jetChamber.ToString()}View";
  122. }
  123. else
  124. {
  125. className = $"Venus_MainPages.Views.{VenusMenu[i].MenuItem[j].View}";
  126. }
  127. Type t = Type.GetType($"{className},Venus_MainPages");
  128. var obj = System.Activator.CreateInstance(t);
  129. if (VenusMenu[i].Id=="PMA" || VenusMenu[i].Id == "PMB" || VenusMenu[i].Id == "PMC" || VenusMenu[i].Id == "PMD" || VenusMenu[i].Id == "TM")
  130. {
  131. MethodInfo methodInfo = t.GetMethod("Init", new Type[] { typeof(string) });
  132. methodInfo?.Invoke(obj, new object[] { VenusMenu[i].Id });
  133. }
  134. tabControl.Items.Add(new TabItem() { Header = VenusMenu[i].MenuItem[j].Name, Content = obj });
  135. }
  136. centerTabViews.Add(tabControl);
  137. }
  138. Main_Frame.Content = centerTabViews[0];
  139. ModuleManager.Initialize();
  140. }
  141. private void AduRadioButtonIcon_Click(object sender, RoutedEventArgs e)
  142. {
  143. var currentButton = sender as AduRadioButtonIcon;
  144. Main_Frame.Content = centerTabViews[Convert.ToInt32(currentButton.Tag)];
  145. }
  146. private void CustomWnd_Closed(object sender, EventArgs e)
  147. {
  148. System.Diagnostics.Process.GetCurrentProcess().Kill();
  149. }
  150. }
  151. }