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

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