终端一体化运控平台
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.
 
 
 

185 line
6.9 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. ProcessControl.GetInstance.Init();
  30. MainView mv = new MainView();
  31. //mv.Show();
  32. LoginView lv = new LoginView();
  33. var res = lv.ShowDialog();
  34. if (res != null && res == true)
  35. {
  36. MessageLog.GetInstance.ShowUserLog("用户登录");
  37. mv.Show();
  38. }
  39. else
  40. mv.Close();
  41. MainWindow = mv;
  42. }
  43. protected override void OnExit(ExitEventArgs e)
  44. {
  45. base.OnExit(e);
  46. MessageLog.GetInstance.LogSave();
  47. ThreadManage.GetInstance().Dispose();
  48. }
  49. private void MenuInit()
  50. {
  51. #region 配方管理菜单
  52. ObservableCollection<SubMenumodel> RecipeManage = new ObservableCollection<SubMenumodel>();
  53. RecipeManage.Add(new SubMenumodel()
  54. {
  55. SubMenuName = "本地配方管理",
  56. SubMenuPermission = new Permission[] { Permission.管理员 },
  57. AssemblyName = "BPASmartClient.JXJFoodBigStation",
  58. ToggleWindowPath = "View.RecipeReceiveView"
  59. });
  60. RecipeManage.Add(new SubMenumodel()
  61. {
  62. SubMenuName = "本地配方下发",
  63. SubMenuPermission = new Permission[] { Permission.管理员 },
  64. AssemblyName = "BPASmartClient.JXJFoodBigStation",
  65. ToggleWindowPath = "View.RecipeSendDownView"
  66. });
  67. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  68. {
  69. MainMenuIcon = "&#xe683;",
  70. MainMenuName = "配方管理",
  71. Alias = "Recipe Management",
  72. subMenumodels = RecipeManage,
  73. });
  74. #endregion
  75. #region 消息日志
  76. ObservableCollection<SubMenumodel> InfoLog = new ObservableCollection<SubMenumodel>();
  77. InfoLog.Add(new SubMenumodel()
  78. {
  79. SubMenuName = "操作日志",
  80. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  81. AssemblyName = "BPASmartClient.CustomResource",
  82. ToggleWindowPath = "Pages.View.UserLogView"
  83. });
  84. InfoLog.Add(new SubMenumodel()
  85. {
  86. SubMenuName = "运行日志",
  87. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  88. AssemblyName = "BPASmartClient.CustomResource",
  89. ToggleWindowPath = "Pages.View.RunLogView"
  90. });
  91. InfoLog.Add(new SubMenumodel()
  92. {
  93. SubMenuName = "报警记录",
  94. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  95. AssemblyName = "BPASmartClient.CustomResource",
  96. ToggleWindowPath = "Pages.View.AlarmView"
  97. });
  98. InfoLog.Add(new SubMenumodel()
  99. {
  100. SubMenuName = "调试日志",
  101. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员, Permission.技术员 },
  102. AssemblyName = "BPASmartClient.CustomResource",
  103. ToggleWindowPath = "Pages.View.DebugLogView"
  104. });
  105. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  106. {
  107. MainMenuIcon = "&#xe668;",
  108. MainMenuName = "消息日志",
  109. Alias = "Message Log",
  110. subMenumodels = InfoLog,
  111. });
  112. #endregion
  113. #region 硬件设备监控
  114. ObservableCollection<SubMenumodel> DeviceMonitor = new ObservableCollection<SubMenumodel>();
  115. DeviceMonitor.Add(new SubMenumodel()
  116. {
  117. SubMenuName = "料仓管理",
  118. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  119. AssemblyName = "BPASmartClient.JXJFoodBigStation",
  120. ToggleWindowPath = "View.DeviceManageView"
  121. });
  122. DeviceMonitor.Add(new SubMenumodel()
  123. {
  124. SubMenuName = "设备状态",
  125. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  126. AssemblyName = "BPASmartClient.JXJFoodBigStation",
  127. ToggleWindowPath = "View.HardwareStatusView"
  128. });
  129. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  130. {
  131. MainMenuIcon = "&#xe603;",
  132. MainMenuName = "设备监控",
  133. Alias = "Device Monitor",
  134. subMenumodels = DeviceMonitor,
  135. });
  136. #endregion
  137. #region 用户管理
  138. ObservableCollection<SubMenumodel> UserManager = new ObservableCollection<SubMenumodel>();
  139. UserManager.Add(new SubMenumodel()
  140. {
  141. SubMenuName = "用户登录",
  142. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  143. AssemblyName = "BPASmartClient.CustomResource",
  144. ToggleWindowPath = "Pages.View.SubPagLoginView"
  145. });
  146. UserManager.Add(new SubMenumodel()
  147. {
  148. SubMenuName = "密码修改",
  149. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  150. AssemblyName = "BPASmartClient.CustomResource",
  151. ToggleWindowPath = "Pages.View.PasswordChangeView"
  152. });
  153. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  154. {
  155. MainMenuIcon = "&#xe66d;",
  156. MainMenuName = "用户管理",
  157. Alias = "User Management",
  158. subMenumodels = UserManager,
  159. });
  160. #endregion
  161. }
  162. private void DataInit()
  163. {
  164. Config.GetInstance.Init();
  165. //Json<LocaPar>.Read();
  166. }
  167. }
  168. }