终端一体化运控平台
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 

182 行
6.7 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. protected override void OnStartup(StartupEventArgs e)
  23. {
  24. base.OnStartup(e);
  25. MenuInit();
  26. DataInit();
  27. MainView mv = new MainView();
  28. LoginView lv = new LoginView();
  29. var res = lv.ShowDialog();
  30. if (res != null && res == true)
  31. mv.Show();
  32. else
  33. mv.Close();
  34. }
  35. protected override void OnExit(ExitEventArgs e)
  36. {
  37. base.OnExit(e);
  38. Json<LocaPar>.Save();
  39. MessageLog.GetInstance.LogSave();
  40. }
  41. private void MenuInit()
  42. {
  43. #region 配方管理菜单
  44. ObservableCollection<SubMenumodel> RecipeManage = new ObservableCollection<SubMenumodel>();
  45. RecipeManage.Add(new SubMenumodel()
  46. {
  47. SubMenuName = "配方管理",
  48. SubMenuPermission = new Permission[] { Permission.管理员 },
  49. AssemblyName = "BPASmartClient.DosingSystem",
  50. ToggleWindowPath = "View.RecipeSettingsView"
  51. });
  52. RecipeManage.Add(new SubMenumodel()
  53. {
  54. SubMenuName = "配方下发",
  55. SubMenuPermission = new Permission[] { Permission.操作员 },
  56. AssemblyName = "BPASmartClient.DosingSystem",
  57. ToggleWindowPath = "View.RecipeControlView"
  58. });
  59. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  60. {
  61. MainMenuIcon = "&#xe683;",
  62. MainMenuName = "配方管理",
  63. Alias = "Recipe Management",
  64. MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员 },
  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. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  92. {
  93. MainMenuIcon = "&#xe668;",
  94. MainMenuName = "消息日志",
  95. Alias = "Message Log",
  96. MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  97. subMenumodels = InfoLog,
  98. });
  99. #endregion
  100. #region 硬件设备监控
  101. ObservableCollection<SubMenumodel> DeviceMonitor = new ObservableCollection<SubMenumodel>();
  102. DeviceMonitor.Add(new SubMenumodel()
  103. {
  104. SubMenuName = "原料设备列表",
  105. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  106. AssemblyName = "BPASmartClient.DosingSystem",
  107. ToggleWindowPath = "View.DeviceListView"
  108. });
  109. DeviceMonitor.Add(new SubMenumodel()
  110. {
  111. SubMenuName = "设备状态",
  112. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  113. AssemblyName = "BPASmartClient.DosingSystem",
  114. ToggleWindowPath = "View.HardwareStatusView"
  115. });
  116. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  117. {
  118. MainMenuIcon = "&#xe603;",
  119. MainMenuName = "设备监控",
  120. Alias = "Device Monitor",
  121. MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  122. subMenumodels = DeviceMonitor,
  123. });
  124. #endregion
  125. #region 用户管理
  126. ObservableCollection<SubMenumodel> UserManager = new ObservableCollection<SubMenumodel>();
  127. UserManager.Add(new SubMenumodel()
  128. {
  129. SubMenuName = "用户登录",
  130. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  131. AssemblyName = "BPASmartClient.CustomResource",
  132. ToggleWindowPath = "Pages.View.SubPagLoginView"
  133. });
  134. UserManager.Add(new SubMenumodel()
  135. {
  136. SubMenuName = "密码修改",
  137. SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  138. AssemblyName = "BPASmartClient.CustomResource",
  139. ToggleWindowPath = "Pages.View.PasswordChangeView"
  140. });
  141. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  142. {
  143. MainMenuIcon = "&#xe66d;",
  144. MainMenuName = "用户管理",
  145. Alias = "User Management",
  146. MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
  147. subMenumodels = UserManager,
  148. });
  149. #endregion
  150. }
  151. private void DataInit()
  152. {
  153. Config.GetInstance.Init();
  154. Json<LocaPar>.Read();
  155. }
  156. }
  157. }