123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- using Prism.Regions;
- using System.Collections.Generic;
- using System.Windows;
- using Venus_Themes.CustomControls;
- using Venus_UI.Themes.Attach;
- using Venus_Unity;
- using System.Linq;
- using System.Threading;
- using System;
- using Venus_MainPages.Views;
- using System.Windows.Controls;
- using Aitex.Core.UI.View.Frame;
- using System.Windows.Media;
- using Venus_Core;
- using System.Reflection;
- using Venus_MainPages.Unity;
- using MECF.Framework.Common.DataCenter;
- using Aitex.Core.RT.SCCore;
- namespace Venus_UI.Views
- {
- /// <summary>
- /// ShellView.xaml 的交互逻辑
- /// </summary>
- public partial class ShellView : Window
- {
- IRegionManager m_regionManager;
- IRegionNavigationService m_regionNavigationService;
- List<VenusMenu> VenusMenu;
- List<TabControl> centerTabViews=new List<TabControl> ();
- List<Button> buttonList=new List<Button> ();
- public ShellView(IRegionManager regionManager, IRegionNavigationService regionNavigationService)
- {
- InitializeComponent();
- m_regionManager = regionManager;
- m_regionNavigationService = regionNavigationService;
- m_regionManager.RegisterViewWithRegion("TopRegion", typeof(Venus_MainPages.Views.TopView));
- VenusGlobalEvents.SlotRightClickChangedEvent += Instance_SlotRightClickChangedEvent;
- }
- private void Instance_SlotRightClickChangedEvent(OpenSEMI.Ctrlib.Controls.Slot slot)
- {
- if (slot != null)
- {
- ContextMenu cm = ContextMenuManager.Instance.GetSlotMenus(slot);
- if (cm != null)
- {
- slot.ContextMenu = cm;
- }
- return;
- }
- }
- private void CustomWnd_Loaded(object sender, RoutedEventArgs e)
- {
- VenusMenu = SerializeHelper.Instance.ReadFromJsonFile<List<VenusMenu>>($"Config/VenusMenu.json");
- int index = 0;
- for (int i = 0; i < VenusMenu.Count; i++)
- {
- if (VenusMenu[i].IsShow == false)
- {
- continue;
- }
- string[] allModules = QueryDataClient.Instance.Service.GetConfig($"System.InstalledModules").ToString().Split(',');
- if (VenusMenu[i].Id == "PMA" || VenusMenu[i].Id == "PMB" || VenusMenu[i].Id == "PMC" || VenusMenu[i].Id == "PMD")
- {
- if (!allModules.Contains(VenusMenu[i].Id))
- {
- continue;
- }
- }
- AduRadioButtonIcon aduRadioButtonIcon = new AduRadioButtonIcon();
- if (i == 0)
- {
- aduRadioButtonIcon.IsChecked = true;
- }
- IconElement.SetPathData(aduRadioButtonIcon,(Geometry)aduRadioButtonIcon.FindResource($"Icon_{VenusMenu[i].Id}"));
- aduRadioButtonIcon.Content = VenusMenu[i].Id;
- aduRadioButtonIcon.Click += AduRadioButtonIcon_Click;
- aduRadioButtonIcon.SelectBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#6AD7FF"));
- aduRadioButtonIcon.SelectColor = new SolidColorBrush((Colors.Black));
- //aduRadioButtonIcon.DefaultBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#6AD7FF"));
- aduRadioButtonIcon.DefaultBackground = new SolidColorBrush(Colors.DarkGray);
-
- aduRadioButtonIcon.Width = 180;
- aduRadioButtonIcon.Height= 40;
-
- //aduRadioButtonIcon.Foreground=Brushes.White;
- aduRadioButtonIcon.Tag = index;
- index += 1;
- Bottom_Frame.Children.Add(aduRadioButtonIcon);
- TabControl tabControl = new TabControl();
- for (int j = 0; j < VenusMenu[i].MenuItem.Count; j++)
- {
- if (VenusMenu[i].MenuItem[j].IsShow == false)
- {
- continue;
- }
- string className;
- if ((VenusMenu[i].Id == "PMA" || VenusMenu[i].Id == "PMB" || VenusMenu[i].Id == "PMC" || VenusMenu[i].Id == "PMD")&& VenusMenu[i].MenuItem[j].Id== "Operation")
- {
- JetChamber jetChamber = (JetChamber)(Convert.ToInt32(QueryDataClient.Instance.Service.GetConfig($"{VenusMenu[i].Id}.ChamberType")));
- className = $"Venus_MainPages.Views.Over{jetChamber.ToString()}View";
- }
- else
- {
- className = $"Venus_MainPages.Views.{VenusMenu[i].MenuItem[j].View}";
- }
- Type t = Type.GetType($"{className},Venus_MainPages");
- var obj = System.Activator.CreateInstance(t);
-
- if (VenusMenu[i].Id=="PMA" || VenusMenu[i].Id == "PMB" || VenusMenu[i].Id == "PMC" || VenusMenu[i].Id == "PMD" || VenusMenu[i].Id == "TM")
- {
- MethodInfo methodInfo = t.GetMethod("Init", new Type[] { typeof(string) });
- methodInfo?.Invoke(obj, new object[] { VenusMenu[i].Id });
- }
- tabControl.Items.Add(new TabItem() { Header = VenusMenu[i].MenuItem[j].Name, Content = obj });
- }
- centerTabViews.Add(tabControl);
- }
- Main_Frame.Content = centerTabViews[0];
- }
- private void AduRadioButtonIcon_Click(object sender, RoutedEventArgs e)
- {
- var currentButton = sender as AduRadioButtonIcon;
- Main_Frame.Content = centerTabViews[Convert.ToInt32(currentButton.Tag)];
- }
- private void CustomWnd_Closed(object sender, EventArgs e)
- {
- System.Diagnostics.Process.GetCurrentProcess().Kill();
- }
- }
- }
|