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

177 regels
6.6 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.HardwareStatusView"
  121. });
  122. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  123. {
  124. MainMenuIcon = "&#xe603;",
  125. MainMenuName = "设备监控",
  126. Alias = "Device Monitor",
  127. subMenumodels = DeviceMonitor,
  128. });
  129. #endregion
  130. #region 用户管理
  131. ObservableCollection<SubMenumodel> UserManager = new ObservableCollection<SubMenumodel>();
  132. UserManager.Add(new SubMenumodel()
  133. {
  134. SubMenuName = "用户登录",
  135. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  136. AssemblyName = "BPASmartClient.CustomResource",
  137. ToggleWindowPath = "Pages.View.SubPagLoginView"
  138. });
  139. UserManager.Add(new SubMenumodel()
  140. {
  141. SubMenuName = "密码修改",
  142. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  143. AssemblyName = "BPASmartClient.CustomResource",
  144. ToggleWindowPath = "Pages.View.PasswordChangeView"
  145. });
  146. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  147. {
  148. MainMenuIcon = "&#xe66d;",
  149. MainMenuName = "用户管理",
  150. Alias = "User Management",
  151. subMenumodels = UserManager,
  152. });
  153. #endregion
  154. }
  155. private void DataInit()
  156. {
  157. //Config.GetInstance.Init();
  158. //Json<LocaPar>.Read();
  159. Json<LocalRecipe>.Read();
  160. }
  161. }
  162. }