|
@@ -2,7 +2,6 @@
|
|
|
using System.Collections.Generic;
|
|
|
using System.Windows;
|
|
|
using Venus_Themes.CustomControls;
|
|
|
-using Venus_UI.Themes.Attach;
|
|
|
using Venus_Unity;
|
|
|
using System.Linq;
|
|
|
using System;
|
|
@@ -21,15 +20,10 @@ using Venus_Themes.Unity;
|
|
|
using MECF.Framework.Common.Equipment;
|
|
|
using WinInterop = System.Windows.Interop;
|
|
|
using System.Runtime.InteropServices;
|
|
|
-using Aitex.Core.RT.SCCore;
|
|
|
-using Venus_Themes.UserControls;
|
|
|
using System.IO;
|
|
|
using System.Windows.Media.Imaging;
|
|
|
-using System.Threading.Tasks;
|
|
|
-using Aitex.Core.UI.View.Frame;
|
|
|
-using System.Runtime.Serialization.Formatters.Binary;
|
|
|
-using System.CodeDom;
|
|
|
-using System.Windows.Media.Animation;
|
|
|
+using Venus_MainPages.Roles;
|
|
|
+using WPF.Themes.UserControls;
|
|
|
|
|
|
namespace Venus_UI.Views
|
|
|
{
|
|
@@ -40,7 +34,8 @@ namespace Venus_UI.Views
|
|
|
{
|
|
|
IRegionManager m_regionManager;
|
|
|
IRegionNavigationService m_regionNavigationService;
|
|
|
- List<VenusMenu> VenusMenu;
|
|
|
+ //List<VenusMenu> VenusMenu;
|
|
|
+ List<RoleDefine> RoleDefines;
|
|
|
public List<TabControl> centerTabViews = new List<TabControl>();
|
|
|
public List<AduRadioButtonIcon> buttonList = new List<AduRadioButtonIcon>();
|
|
|
DispatcherTimer timer = new DispatcherTimer();
|
|
@@ -198,83 +193,121 @@ namespace Venus_UI.Views
|
|
|
//this.ResizeMode = ResizeMode.CanResize;
|
|
|
//System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width / SystemParameters.PrimaryScreenWidth
|
|
|
|
|
|
- VenusMenu = SerializeHelper.Instance.ReadFromJsonFile<List<VenusMenu>>($"Config/UIMenu.json");
|
|
|
- int index = 0;
|
|
|
- for (int i = 0; i < VenusMenu.Count; i++)
|
|
|
+ //VenusMenu = SerializeHelper.Instance.ReadFromJsonFile<List<VenusMenu>>($"Config/UIMenu.json");
|
|
|
+ //App.currentUser
|
|
|
+ string configPath = "";
|
|
|
+ if (File.Exists($"Config/UIMenu.json"))
|
|
|
{
|
|
|
- if (VenusMenu[i].IsShow == false)
|
|
|
+ configPath = $"Config/UIMenu.json";
|
|
|
+ }
|
|
|
+ else if (File.Exists($"Config/Menu.json"))
|
|
|
+ {
|
|
|
+ configPath = $"Config/Menu.json";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ WPFMessageBox.ShowError("未发现UI Config配置文件,退出UI");
|
|
|
+ this.Close();
|
|
|
+ }
|
|
|
+ RoleDefines = SerializeHelper.Instance.ReadFromJsonFile<List<RoleDefine>>(configPath);
|
|
|
+ string[] allModules = QueryDataClient.Instance.Service.GetConfig($"System.InstalledModules").ToString().Split(',');
|
|
|
+ //TabControl tabControl = new TabControl();
|
|
|
+ int role = (int)App.CurrentUser.Role;
|
|
|
+ var menu = RoleDefines[role].Menus;
|
|
|
+ List<string> modules = new List<string>();
|
|
|
+ for (int i = 0; i < menu.Count; i++)
|
|
|
+ {
|
|
|
+ if (!modules.Contains(menu[i].FirstMenu))
|
|
|
+ {
|
|
|
+ modules.Add(menu[i].FirstMenu);
|
|
|
+ centerTabViews.Add(new TabControl());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ int index = -1;
|
|
|
+ string lastModule="";
|
|
|
+
|
|
|
+ for (int i = 0; i < menu.Count; i++)
|
|
|
+ {
|
|
|
+ if (menu[i].Permission == MenuPermission.None)
|
|
|
{
|
|
|
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" || VenusMenu[i].Id == "TM")
|
|
|
+ if (menu[i].FirstMenu == "PMA" || menu[i].FirstMenu == "PMB" || menu[i].FirstMenu == "PMC" || menu[i].FirstMenu == "PMD" || menu[i].FirstMenu == "TM")
|
|
|
{
|
|
|
- if (!allModules.Contains(VenusMenu[i].Id))
|
|
|
+ if (!allModules.Contains(menu[i].FirstMenu))
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //if (VenusMenu[i].Id == "SETM" && SC.GetStringValue("System.ChamberSelect") !="4" && SC.GetStringValue("System.ChamberSelect") != "5")
|
|
|
- //{
|
|
|
- // //不是SE DE
|
|
|
- // continue;
|
|
|
- //}
|
|
|
|
|
|
- AduRadioButtonIcon aduRadioButtonIcon = new AduRadioButtonIcon();
|
|
|
- Button button = new Button();
|
|
|
- if (i == 0)
|
|
|
+ string className;
|
|
|
+ if ((menu[i].FirstMenu == "PMA" || menu[i].FirstMenu == "PMB" || menu[i].FirstMenu == "PMC" || menu[i].FirstMenu == "PMD") && menu[i].SecondMenu=="Operation")
|
|
|
{
|
|
|
- aduRadioButtonIcon.IsChecked = true;
|
|
|
+ JetChamber jetChamber = (JetChamber)(Convert.ToInt32(QueryDataClient.Instance.Service.GetConfig($"{menu[i].FirstMenu}.ChamberType")));
|
|
|
+ className = $"Venus_MainPages.Views.Over{jetChamber.ToString()}View";
|
|
|
}
|
|
|
- IconElement.SetPathData(aduRadioButtonIcon, (Geometry)aduRadioButtonIcon.FindResource($"Icon_{VenusMenu[i].Id}"));
|
|
|
- aduRadioButtonIcon.Content = VenusMenu[i].Name;
|
|
|
- aduRadioButtonIcon.Checked += AduRadioButtonIcon_Click;
|
|
|
- aduRadioButtonIcon.SelectBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#0076C4"));
|
|
|
- aduRadioButtonIcon.SelectColor = new SolidColorBrush((Colors.White));
|
|
|
- //aduRadioButtonIcon.DefaultBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#94BCD7"));
|
|
|
- //aduRadioButtonIcon.DefaultBackground = new SolidColorBrush(Colors.DarkGray);
|
|
|
-
|
|
|
-
|
|
|
- aduRadioButtonIcon.Width = 180;
|
|
|
- //aduRadioButtonIcon.Height = 40;
|
|
|
-
|
|
|
- //aduRadioButtonIcon.Foreground=Brushes.White;
|
|
|
- aduRadioButtonIcon.Tag = index;
|
|
|
- buttonList.Add(aduRadioButtonIcon);
|
|
|
- index += 1;
|
|
|
- Bottom_Frame.Children.Add(aduRadioButtonIcon);
|
|
|
-
|
|
|
- TabControl tabControl = new TabControl();
|
|
|
- for (int j = 0; j < VenusMenu[i].MenuItem.Count; j++)
|
|
|
+ else
|
|
|
{
|
|
|
- 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}";
|
|
|
- }
|
|
|
+ className = $"Venus_MainPages.Views.{menu[i].View}";
|
|
|
+ }
|
|
|
|
|
|
- Type t = Type.GetType($"{className},Venus_MainPages");
|
|
|
- var obj = System.Activator.CreateInstance(t);
|
|
|
+ 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" || VenusMenu[i].Id == "SETM")
|
|
|
+ if (menu[i].FirstMenu == "PMA" || menu[i].FirstMenu == "PMB" || menu[i].FirstMenu == "PMC" || menu[i].FirstMenu == "PMD" || menu[i].FirstMenu == "TM" || menu[i].FirstMenu == "SETM")
|
|
|
+ {
|
|
|
+ MethodInfo methodInfo = t.GetMethod("Init", new Type[] { typeof(string) });
|
|
|
+ methodInfo?.Invoke(obj, new object[] { menu[i].FirstMenu });
|
|
|
+ }
|
|
|
+ if (lastModule != menu[i].FirstMenu)
|
|
|
+ {
|
|
|
+ AduRadioButtonIcon aduRadioButtonIcon = new AduRadioButtonIcon();
|
|
|
+ index += 1;
|
|
|
+ if (index == 0)
|
|
|
{
|
|
|
- MethodInfo methodInfo = t.GetMethod("Init", new Type[] { typeof(string) });
|
|
|
- methodInfo?.Invoke(obj, new object[] { VenusMenu[i].Id });
|
|
|
+ aduRadioButtonIcon.IsChecked = true;
|
|
|
}
|
|
|
- tabControl.Items.Add(new TabItem() { Header = VenusMenu[i].MenuItem[j].Name, Content = obj });
|
|
|
+ //IconElement.SetPathData(aduRadioButtonIcon, (Geometry)aduRadioButtonIcon.FindResource($"Icon_{menu[i].se}"));
|
|
|
+ aduRadioButtonIcon.Content = menu[i].FirstMenu;
|
|
|
+ aduRadioButtonIcon.Checked += AduRadioButtonIcon_Click;
|
|
|
+ aduRadioButtonIcon.SelectBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#0076C4"));
|
|
|
+ aduRadioButtonIcon.SelectColor = new SolidColorBrush((Colors.White));
|
|
|
+ //aduRadioButtonIcon.DefaultBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#94BCD7"));
|
|
|
+ //aduRadioButtonIcon.DefaultBackground = new SolidColorBrush(Colors.DarkGray);
|
|
|
+
|
|
|
+
|
|
|
+ aduRadioButtonIcon.Width = 180;
|
|
|
+ //aduRadioButtonIcon.Height = 40;
|
|
|
+
|
|
|
+ //aduRadioButtonIcon.Foreground=Brushes.White;
|
|
|
+ aduRadioButtonIcon.Tag = index;
|
|
|
+ buttonList.Add(aduRadioButtonIcon);
|
|
|
+
|
|
|
+ Bottom_Frame.Children.Add(aduRadioButtonIcon);
|
|
|
}
|
|
|
- centerTabViews.Add(tabControl);
|
|
|
+ TabItem tabItem = new TabItem() { Header = menu[i].SecondMenu, Content = obj };
|
|
|
+ if (menu[i].Permission == MenuPermission.ReadOnly)
|
|
|
+ {
|
|
|
+ (tabItem.Content as Control).IsEnabled = false;
|
|
|
+ }
|
|
|
+ centerTabViews[index].Items.Add(tabItem);
|
|
|
+ lastModule = menu[i].FirstMenu;
|
|
|
+ //tabControl.Items.Add(new TabItem() { Header = menu[i].SecondMenu, Content = obj });
|
|
|
+
|
|
|
+
|
|
|
+ //for (int j = 0; j < menu.Count; j++)
|
|
|
+ //{
|
|
|
+ // if (menu[j].Permission == MenuPermission.None)
|
|
|
+ // {
|
|
|
+ // continue;
|
|
|
+ // }
|
|
|
+
|
|
|
+ //}
|
|
|
+ //centerTabViews.Add(tabControl);
|
|
|
}
|
|
|
Main_Frame.Content = centerTabViews[0];
|
|
|
ModuleManager.Initialize();
|