终端一体化运控平台
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

230 linhas
9.0 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections.ObjectModel;
  4. using System.Configuration;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Threading.Tasks;
  8. using System.Windows;
  9. using BPASmartClient.CustomResource.Pages.Enums;
  10. using BPASmartClient.CustomResource.Pages.Model;
  11. using BPASmartClient.CustomResource.Pages.View;
  12. namespace BPASmartClient.SmallBatchingSystem
  13. {
  14. /// <summary>
  15. /// Interaction logic for App.xaml
  16. /// </summary>
  17. public partial class App : Application
  18. {
  19. public static Window MainWindow;
  20. protected override void OnStartup(StartupEventArgs e)
  21. {
  22. base.OnStartup(e);
  23. AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
  24. MenuInit();
  25. MainView mv = new MainView();
  26. LoginView lv = new LoginView();
  27. var res = lv.ShowDialog();
  28. if (res != null && res == true)
  29. {
  30. MessageLog.GetInstance.ShowUserLog("用户登录");
  31. mv.Show();
  32. }
  33. else
  34. mv.Close();
  35. MainWindow = mv;
  36. }
  37. private void MenuInit()
  38. {
  39. #region 配方管理菜单
  40. ObservableCollection<SubMenumodel> RecipeManage = new ObservableCollection<SubMenumodel>();
  41. RecipeManage.Add(new SubMenumodel()
  42. {
  43. SubMenuName = "配方管理",
  44. SubMenuPermission = new Permission[] { Permission.管理员 },
  45. AssemblyName = "BPASmartClient.DosingSystem",
  46. ToggleWindowPath = "View.RecipeSettingsView"
  47. });
  48. RecipeManage.Add(new SubMenumodel()
  49. {
  50. SubMenuName = "配方下发",
  51. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员 },
  52. AssemblyName = "BPASmartClient.DosingSystem",
  53. ToggleWindowPath = "View.RecipeControlView"
  54. });
  55. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  56. {
  57. MainMenuIcon = "&#xe683;",
  58. MainMenuName = "配方管理",
  59. Alias = "Recipe Management",
  60. subMenumodels = RecipeManage,
  61. });
  62. #endregion
  63. //#region 参数设置
  64. //ObservableCollection<SubMenumodel> ParSet = new ObservableCollection<SubMenumodel>();
  65. //ParSet.Add(new SubMenumodel()
  66. //{
  67. // SubMenuName = "原料参数设置",
  68. // SubMenuPermission = new Permission[] { Permission.管理员 },
  69. // AssemblyName = "BPASmartClient.DosingSystem",
  70. // ToggleWindowPath = "View.DeviceMaterialParView"
  71. //});
  72. //MenuManage.GetInstance.menuModels.Add(new MenuModel()
  73. //{
  74. // MainMenuIcon = "&#xe62d;",
  75. // MainMenuName = "参数设置",
  76. // Alias = "Parameter Set",
  77. // subMenumodels = ParSet,
  78. //});
  79. //#endregion
  80. #region 手动控制
  81. ObservableCollection<SubMenumodel> ManualControl = new ObservableCollection<SubMenumodel>();
  82. ManualControl.Add(new SubMenumodel()
  83. {
  84. SubMenuName = "手动控制",
  85. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  86. AssemblyName = "BPASmartClient.DosingSystem",
  87. ToggleWindowPath = "View.ManualControlView"
  88. });
  89. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  90. {
  91. MainMenuIcon = "&#xe622;",
  92. MainMenuName = "手动控制",
  93. Alias = "Parameter Set",
  94. subMenumodels = ManualControl,
  95. });
  96. #endregion
  97. #region 消息日志
  98. ObservableCollection<SubMenumodel> InfoLog = new ObservableCollection<SubMenumodel>();
  99. InfoLog.Add(new SubMenumodel()
  100. {
  101. SubMenuName = "操作日志",
  102. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  103. AssemblyName = "BPASmartClient.CustomResource",
  104. ToggleWindowPath = "Pages.View.UserLogView"
  105. });
  106. InfoLog.Add(new SubMenumodel()
  107. {
  108. SubMenuName = "运行日志",
  109. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  110. AssemblyName = "BPASmartClient.CustomResource",
  111. ToggleWindowPath = "Pages.View.RunLogView"
  112. });
  113. InfoLog.Add(new SubMenumodel()
  114. {
  115. SubMenuName = "报警记录",
  116. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  117. AssemblyName = "BPASmartClient.CustomResource",
  118. ToggleWindowPath = "Pages.View.AlarmView"
  119. });
  120. InfoLog.Add(new SubMenumodel()
  121. {
  122. SubMenuName = "调试日志",
  123. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员, Permission.技术员 },
  124. AssemblyName = "BPASmartClient.CustomResource",
  125. ToggleWindowPath = "Pages.View.DebugLogView"
  126. });
  127. InfoLog.Add(new SubMenumodel()
  128. {
  129. SubMenuName = "报表数据",
  130. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员, Permission.技术员 },
  131. AssemblyName = "BPASmartClient.CustomResource",
  132. ToggleWindowPath = "Pages.View.ReportView"
  133. });
  134. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  135. {
  136. MainMenuIcon = "&#xe668;",
  137. MainMenuName = "消息日志",
  138. Alias = "Message Log",
  139. subMenumodels = InfoLog,
  140. });
  141. #endregion
  142. #region 硬件设备监控
  143. ObservableCollection<SubMenumodel> DeviceMonitor = new ObservableCollection<SubMenumodel>();
  144. DeviceMonitor.Add(new SubMenumodel()
  145. {
  146. SubMenuName = "原料设备列表",
  147. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  148. AssemblyName = "BPASmartClient.DosingSystem",
  149. ToggleWindowPath = "View.DeviceListView"
  150. });
  151. DeviceMonitor.Add(new SubMenumodel()
  152. {
  153. SubMenuName = "设备状态",
  154. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  155. AssemblyName = "BPASmartClient.DosingSystem",
  156. ToggleWindowPath = "View.HardwareStatusView"
  157. });
  158. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  159. {
  160. MainMenuIcon = "&#xe603;",
  161. MainMenuName = "设备监控",
  162. Alias = "Device Monitor",
  163. subMenumodels = DeviceMonitor,
  164. });
  165. #endregion
  166. #region 用户管理
  167. ObservableCollection<SubMenumodel> UserManager = new ObservableCollection<SubMenumodel>();
  168. UserManager.Add(new SubMenumodel()
  169. {
  170. SubMenuName = "用户登录",
  171. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  172. AssemblyName = "BPASmartClient.CustomResource",
  173. ToggleWindowPath = "Pages.View.SubPagLoginView"
  174. });
  175. UserManager.Add(new SubMenumodel()
  176. {
  177. SubMenuName = "密码修改",
  178. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  179. AssemblyName = "BPASmartClient.CustomResource",
  180. ToggleWindowPath = "Pages.View.PasswordChangeView"
  181. });
  182. UserManager.Add(new SubMenumodel()
  183. {
  184. SubMenuName = "用户管理",
  185. SubMenuPermission = new Permission[] { Permission.管理员 },
  186. AssemblyName = "BPASmartClient.CustomResource",
  187. ToggleWindowPath = "Pages.View.UserManagerView"
  188. });
  189. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  190. {
  191. MainMenuIcon = "&#xe66d;",
  192. MainMenuName = "用户管理",
  193. Alias = "User Management",
  194. subMenumodels = UserManager,
  195. });
  196. #endregion
  197. }
  198. private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
  199. {
  200. throw new NotImplementedException();
  201. }
  202. protected override void OnExit(ExitEventArgs e)
  203. {
  204. base.OnExit(e);
  205. }
  206. }
  207. }