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

171 rivejä
6.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. 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. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  61. {
  62. MainMenuIcon = "&#xe683;",
  63. MainMenuName = "配方管理",
  64. Alias = "Recipe Management",
  65. subMenumodels = RecipeManage,
  66. });
  67. #endregion
  68. #region 消息日志
  69. ObservableCollection<SubMenumodel> InfoLog = new ObservableCollection<SubMenumodel>();
  70. InfoLog.Add(new SubMenumodel()
  71. {
  72. SubMenuName = "操作日志",
  73. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  74. AssemblyName = "BPASmartClient.CustomResource",
  75. ToggleWindowPath = "Pages.View.UserLogView"
  76. });
  77. InfoLog.Add(new SubMenumodel()
  78. {
  79. SubMenuName = "运行日志",
  80. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  81. AssemblyName = "BPASmartClient.CustomResource",
  82. ToggleWindowPath = "Pages.View.RunLogView"
  83. });
  84. InfoLog.Add(new SubMenumodel()
  85. {
  86. SubMenuName = "报警记录",
  87. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
  88. AssemblyName = "BPASmartClient.CustomResource",
  89. ToggleWindowPath = "Pages.View.AlarmView"
  90. });
  91. InfoLog.Add(new SubMenumodel()
  92. {
  93. SubMenuName = "调试日志",
  94. SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员, Permission.技术员 },
  95. AssemblyName = "BPASmartClient.CustomResource",
  96. ToggleWindowPath = "Pages.View.DebugLogView"
  97. });
  98. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  99. {
  100. MainMenuIcon = "&#xe668;",
  101. MainMenuName = "消息日志",
  102. Alias = "Message Log",
  103. subMenumodels = InfoLog,
  104. });
  105. #endregion
  106. #region 硬件设备监控
  107. ObservableCollection<SubMenumodel> DeviceMonitor = new ObservableCollection<SubMenumodel>();
  108. DeviceMonitor.Add(new SubMenumodel()
  109. {
  110. SubMenuName = "设备状态",
  111. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  112. AssemblyName = "BPASmartClient.JXJFoodBigStation",
  113. ToggleWindowPath = "View.HardwareStatusView"
  114. });
  115. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  116. {
  117. MainMenuIcon = "&#xe603;",
  118. MainMenuName = "设备监控",
  119. Alias = "Device Monitor",
  120. subMenumodels = DeviceMonitor,
  121. });
  122. #endregion
  123. #region 用户管理
  124. ObservableCollection<SubMenumodel> UserManager = new ObservableCollection<SubMenumodel>();
  125. UserManager.Add(new SubMenumodel()
  126. {
  127. SubMenuName = "用户登录",
  128. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  129. AssemblyName = "BPASmartClient.CustomResource",
  130. ToggleWindowPath = "Pages.View.SubPagLoginView"
  131. });
  132. UserManager.Add(new SubMenumodel()
  133. {
  134. SubMenuName = "密码修改",
  135. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  136. AssemblyName = "BPASmartClient.CustomResource",
  137. ToggleWindowPath = "Pages.View.PasswordChangeView"
  138. });
  139. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  140. {
  141. MainMenuIcon = "&#xe66d;",
  142. MainMenuName = "用户管理",
  143. Alias = "User Management",
  144. subMenumodels = UserManager,
  145. });
  146. #endregion
  147. }
  148. private void DataInit()
  149. {
  150. Config.GetInstance.Init();
  151. //Json<LocaPar>.Read();
  152. }
  153. }
  154. }