|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Configuration;
- using System.Data;
- using System.Linq;
- using System.Threading.Tasks;
- using System.Windows;
- using BPASmartClient.CustomResource.Pages.Enums;
- using BPASmartClient.CustomResource.Pages.Model;
- using BPASmartClient.CustomResource.Pages.View;
- using BPASmartClient.DosingSystem.Model;
- using BPASmartClient.DosingSystem.View;
- using BPASmartClient.Helper;
-
- namespace BPASmartClient.DosingSystem
- {
- /// <summary>
- /// Interaction logic for App.xaml
- /// </summary>
- public partial class App : Application
- {
- protected override void OnStartup(StartupEventArgs e)
- {
- base.OnStartup(e);
- MenuInit();
- DataInit();
-
- MainView mv = new MainView();
- LoginView lv = new LoginView();
- var res = lv.ShowDialog();
- if (res != null && res == true)
- mv.Show();
- else
- mv.Close();
-
- }
-
- protected override void OnExit(ExitEventArgs e)
- {
- base.OnExit(e);
- Json<LocaPar>.Save();
- MessageLog.GetInstance.LogSave();
- }
-
- private void MenuInit()
- {
-
- #region 配方管理菜单
- ObservableCollection<SubMenumodel> RecipeManage = new ObservableCollection<SubMenumodel>();
- RecipeManage.Add(new SubMenumodel()
- {
- SubMenuName = "配方管理",
- SubMenuPermission = new Permission[] { Permission.管理员 },
- AssemblyName = "BPASmartClient.DosingSystem",
- ToggleWindowPath = "View.RecipeSettingsView"
- });
-
- RecipeManage.Add(new SubMenumodel()
- {
- SubMenuName = "配方下发",
- SubMenuPermission = new Permission[] { Permission.操作员 },
- AssemblyName = "BPASmartClient.DosingSystem",
- ToggleWindowPath = "View.RecipeControlView"
- });
-
- MenuManage.GetInstance.menuModels.Add(new MenuModel()
- {
- MainMenuIcon = "",
- MainMenuName = "配方管理",
- Alias = "Recipe Management",
- MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员 },
- subMenumodels = RecipeManage,
- });
- #endregion
-
- #region 消息日志
- ObservableCollection<SubMenumodel> InfoLog = new ObservableCollection<SubMenumodel>();
- InfoLog.Add(new SubMenumodel()
- {
- SubMenuName = "操作日志",
- SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
- AssemblyName = "BPASmartClient.CustomResource",
- ToggleWindowPath = "Pages.View.UserLogView"
- });
-
- InfoLog.Add(new SubMenumodel()
- {
- SubMenuName = "运行日志",
- SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
- AssemblyName = "BPASmartClient.CustomResource",
- ToggleWindowPath = "Pages.View.RunLogView"
- });
-
- InfoLog.Add(new SubMenumodel()
- {
- SubMenuName = "报警记录",
- SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
- AssemblyName = "BPASmartClient.CustomResource",
- ToggleWindowPath = "Pages.View.AlarmView"
- });
-
- MenuManage.GetInstance.menuModels.Add(new MenuModel()
- {
- MainMenuIcon = "",
- MainMenuName = "消息日志",
- Alias = "Message Log",
- MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
- subMenumodels = InfoLog,
- });
- #endregion
-
- #region 硬件设备监控
- ObservableCollection<SubMenumodel> DeviceMonitor = new ObservableCollection<SubMenumodel>();
- DeviceMonitor.Add(new SubMenumodel()
- {
- SubMenuName = "原料设备列表",
- SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
- AssemblyName = "BPASmartClient.DosingSystem",
- ToggleWindowPath = "View.DeviceListView"
- });
-
- DeviceMonitor.Add(new SubMenumodel()
- {
- SubMenuName = "设备状态",
- SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
- AssemblyName = "BPASmartClient.DosingSystem",
- ToggleWindowPath = "View.HardwareStatusView"
- });
-
-
-
-
- MenuManage.GetInstance.menuModels.Add(new MenuModel()
- {
- MainMenuIcon = "",
- MainMenuName = "设备监控",
- Alias = "Device Monitor",
- MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
- subMenumodels = DeviceMonitor,
- });
- #endregion
-
- #region 用户管理
- ObservableCollection<SubMenumodel> UserManager = new ObservableCollection<SubMenumodel>();
- UserManager.Add(new SubMenumodel()
- {
- SubMenuName = "用户登录",
- SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
- AssemblyName = "BPASmartClient.CustomResource",
- ToggleWindowPath = "Pages.View.SubPagLoginView"
- });
-
- UserManager.Add(new SubMenumodel()
- {
- SubMenuName = "密码修改",
- SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
- AssemblyName = "BPASmartClient.CustomResource",
- ToggleWindowPath = "Pages.View.PasswordChangeView"
- });
-
-
- MenuManage.GetInstance.menuModels.Add(new MenuModel()
- {
- MainMenuIcon = "",
- MainMenuName = "用户管理",
- Alias = "User Management",
- MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
- subMenumodels = UserManager,
- });
- #endregion
- }
-
- private void DataInit()
- {
- Config.GetInstance.Init();
- Json<LocaPar>.Read();
- }
-
- }
- }
|