终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

191 lines
7.3 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;
  8. using System.Threading.Tasks;
  9. using System.Windows;
  10. using BPASmartClient.CustomResource.Pages.Enums;
  11. using BPASmartClient.CustomResource.Pages.Model;
  12. using BPASmartClient.CustomResource.Pages.View;
  13. using BPASmartClient.CustomResource.Pages.ViewModel;
  14. using BPASmartClient.Helper;
  15. using BPASmartClient.JXJFoodBigStation.Model;
  16. namespace BPASmartClient.JXJFoodBigStation
  17. {
  18. /// <summary>
  19. /// Interaction logic for App.xaml
  20. /// </summary>
  21. public partial class App : Application
  22. {
  23. public static Window MainWindow;
  24. protected override void OnStartup(StartupEventArgs e)
  25. {
  26. base.OnStartup(e);
  27. MenuInit();
  28. DataInit();
  29. MainView mv = new MainView();
  30. ProcessControl.GetInstance.Init();
  31. LoginView lv = new LoginView();
  32. var res = lv.ShowDialog();
  33. if (res != null && res == true)
  34. {
  35. MessageNotify.GetInstance.ShowUserLog("用户登录");
  36. mv.Show();
  37. }
  38. else
  39. mv.Close();
  40. MainWindow = mv;
  41. }
  42. protected override void OnExit(ExitEventArgs e)
  43. {
  44. base.OnExit(e);
  45. MessageNotify.GetInstance.LogSave();
  46. ThreadManage.GetInstance().Dispose();
  47. }
  48. private void MenuInit()
  49. {
  50. #region 配方管理菜单
  51. ObservableCollection<SubMenumodel> RecipeManage = new ObservableCollection<SubMenumodel>();
  52. RecipeManage.Add(new SubMenumodel()
  53. {
  54. SubMenuName = "配方管理",
  55. SubMenuPermission = new Permission[] { Permission.管理员 },
  56. AssemblyName = "BPASmartClient.JXJFoodBigStation",
  57. ToggleWindowPath = "View.RecipeReceiveView"
  58. });
  59. RecipeManage.Add(new SubMenumodel()
  60. {
  61. SubMenuName = "本地配方下发",
  62. SubMenuPermission = new Permission[] { Permission.管理员 },
  63. AssemblyName = "BPASmartClient.JXJFoodBigStation",
  64. ToggleWindowPath = "View.RecipeSendDownView"
  65. });
  66. RecipeManage.Add(new SubMenumodel()
  67. {
  68. SubMenuName = "西门子配方下发",
  69. SubMenuPermission = new Permission[] { Permission.管理员 },
  70. AssemblyName = "BPASmartClient.JXJFoodBigStation",
  71. ToggleWindowPath = "View.SiemensRecipeSendDownView"
  72. });
  73. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  74. {
  75. MainMenuIcon = "&#xe683;",
  76. MainMenuName = "配方管理",
  77. Alias = "Recipe Management",
  78. subMenumodels = RecipeManage,
  79. });
  80. #endregion
  81. #region 消息日志
  82. ObservableCollection<SubMenumodel> InfoLog = new ObservableCollection<SubMenumodel>();
  83. InfoLog.Add(new SubMenumodel()
  84. {
  85. SubMenuName = "操作日志",
  86. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  87. AssemblyName = "BPASmartClient.CustomResource",
  88. ToggleWindowPath = "Pages.View.UserLogView"
  89. });
  90. InfoLog.Add(new SubMenumodel()
  91. {
  92. SubMenuName = "运行日志",
  93. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  94. AssemblyName = "BPASmartClient.CustomResource",
  95. ToggleWindowPath = "Pages.View.RunLogView"
  96. });
  97. InfoLog.Add(new SubMenumodel()
  98. {
  99. SubMenuName = "报警记录",
  100. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  101. AssemblyName = "BPASmartClient.CustomResource",
  102. ToggleWindowPath = "Pages.View.AlarmView"
  103. });
  104. InfoLog.Add(new SubMenumodel()
  105. {
  106. SubMenuName = "调试日志",
  107. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员, Permission.技术员 },
  108. AssemblyName = "BPASmartClient.CustomResource",
  109. ToggleWindowPath = "Pages.View.DebugLogView"
  110. });
  111. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  112. {
  113. MainMenuIcon = "&#xe668;",
  114. MainMenuName = "消息日志",
  115. Alias = "Message Log",
  116. subMenumodels = InfoLog,
  117. });
  118. #endregion
  119. #region 硬件设备监控
  120. ObservableCollection<SubMenumodel> DeviceMonitor = new ObservableCollection<SubMenumodel>();
  121. DeviceMonitor.Add(new SubMenumodel()
  122. {
  123. SubMenuName = "设备状态",
  124. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  125. AssemblyName = "BPASmartClient.JXJFoodBigStation",
  126. ToggleWindowPath = "View.HardwareStatusView"
  127. });
  128. DeviceMonitor.Add(new SubMenumodel()
  129. {
  130. SubMenuName = "通讯状态",
  131. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  132. AssemblyName = "BPASmartClient.JXJFoodBigStation",
  133. ToggleWindowPath = "View.HKPlcCommMonitorView"
  134. });
  135. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  136. {
  137. MainMenuIcon = "&#xe603;",
  138. MainMenuName = "设备监控",
  139. Alias = "Device Monitor",
  140. subMenumodels = DeviceMonitor,
  141. });
  142. #endregion
  143. #region 用户管理
  144. ObservableCollection<SubMenumodel> UserManager = new ObservableCollection<SubMenumodel>();
  145. UserManager.Add(new SubMenumodel()
  146. {
  147. SubMenuName = "用户登录",
  148. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  149. AssemblyName = "BPASmartClient.CustomResource",
  150. ToggleWindowPath = "Pages.View.SubPagLoginView"
  151. });
  152. UserManager.Add(new SubMenumodel()
  153. {
  154. SubMenuName = "密码修改",
  155. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  156. AssemblyName = "BPASmartClient.CustomResource",
  157. ToggleWindowPath = "Pages.View.PasswordChangeView"
  158. });
  159. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  160. {
  161. MainMenuIcon = "&#xe66d;",
  162. MainMenuName = "用户管理",
  163. Alias = "User Management",
  164. subMenumodels = UserManager,
  165. });
  166. #endregion
  167. }
  168. private void DataInit()
  169. {
  170. //Config.GetInstance.Init();
  171. //Json<LocaPar>.Read();
  172. Json<LocalRecipe>.Read();
  173. }
  174. }
  175. }