123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- using OpenSEMI.Ctrlib.Window;
- 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)
- {
- JetChamber jetChamber = (JetChamber)(SC.GetValue<int>("System.ChamberSelect"));//Venus or Kepler
- VenusMenu = SerializeHelper.Instance.ReadFromJsonFile<List<VenusMenu>>($"Config/{jetChamber.ToString()}Menu.json");
- int index = 0;
- for (int i = 0; i < VenusMenu.Count; i++)
- {
- if (VenusMenu[i].IsShow == false)
- {
- 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.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 = $"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();
- }
- }
- }
|