终端一体化运控平台
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 lines
6.1 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 BPA.Helper;
  10. using BPASmartClient.CustomResource.Pages.Enums;
  11. using BPASmartClient.CustomResource.Pages.Model;
  12. using BPASmartClient.CustomResource.Pages.View;
  13. namespace BPASmartClient.SmallBatchingSystem
  14. {
  15. /// <summary>
  16. /// Interaction logic for App.xaml
  17. /// </summary>
  18. public partial class App : Application
  19. {
  20. public static Window MainWindow;
  21. protected override void OnStartup(StartupEventArgs e)
  22. {
  23. //1366*768
  24. base.OnStartup(e);
  25. BPASmartClient.Helper.SystemHelper.GetInstance.CreateDesktopShortcut();
  26. AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
  27. Json<ConfigInfoModel>.Read();
  28. Json<CommunicationPar>.Read();
  29. MenuInit();
  30. MainView mv = new MainView();
  31. Control.GetInstance.Init();
  32. mv.TitleName = "黑菠萝自动化配料系统";
  33. //mv.Show();
  34. LoginView lv = new LoginView();
  35. var res = lv.ShowDialog();
  36. if (res != null && res == true)
  37. {
  38. Control.GetInstance.OperationLog("用户登录");
  39. mv.Show();
  40. }
  41. else
  42. mv.Close();
  43. MainWindow = mv;
  44. }
  45. private void MenuInit()
  46. {
  47. #region 配方管理菜单
  48. ObservableCollection<SubMenumodel> RecipeManage = new ObservableCollection<SubMenumodel>();
  49. RecipeManage.Add(new SubMenumodel()
  50. {
  51. SubMenuName = "料仓管理",
  52. AssemblyName = "BPASmartClient.SmallBatchingSystem",
  53. SubMenuVisibility = Visibility.Visible,
  54. ToggleWindowPath = "Views.SiloManagementView"
  55. });
  56. RecipeManage.Add(new SubMenumodel()
  57. {
  58. SubMenuName = "出料口管理",
  59. AssemblyName = "BPASmartClient.SmallBatchingSystem",
  60. SubMenuVisibility = Visibility.Visible,
  61. ToggleWindowPath = "Views.OutletManagementView"
  62. });
  63. RecipeManage.Add(new SubMenumodel()
  64. {
  65. SubMenuName = "配方管理",
  66. AssemblyName = "BPASmartClient.SmallBatchingSystem",
  67. SubMenuVisibility = Visibility.Visible,
  68. ToggleWindowPath = "Views.RecipeView"
  69. });
  70. RecipeManage.Add(new SubMenumodel()
  71. {
  72. SubMenuName = "配方下发",
  73. AssemblyName = "BPASmartClient.SmallBatchingSystem",
  74. SubMenuVisibility = Visibility.Visible,
  75. ToggleWindowPath = "Views.RecipeControlView"
  76. });
  77. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  78. {
  79. MainMenuIcon = "&#xe683;",
  80. MainMenuName = "配方管理",
  81. Alias = "Recipe Management",
  82. subMenumodels = RecipeManage,
  83. });
  84. #endregion
  85. #region 消息日志
  86. ObservableCollection<SubMenumodel> InfoLog = new ObservableCollection<SubMenumodel>();
  87. InfoLog.Add(new SubMenumodel()
  88. {
  89. SubMenuName = "操作日志",
  90. AssemblyName = "BPASmartClient.CustomResource",
  91. SubMenuVisibility = Visibility.Visible,
  92. ToggleWindowPath = "Pages.View.UserLogView"
  93. });
  94. InfoLog.Add(new SubMenumodel()
  95. {
  96. SubMenuName = "运行日志",
  97. AssemblyName = "BPASmartClient.CustomResource",
  98. SubMenuVisibility = Visibility.Visible,
  99. ToggleWindowPath = "Pages.View.RunLogView"
  100. });
  101. InfoLog.Add(new SubMenumodel()
  102. {
  103. SubMenuName = "调试日志",
  104. AssemblyName = "BPASmartClient.CustomResource",
  105. SubMenuVisibility = Visibility.Visible,
  106. ToggleWindowPath = "Pages.View.DebugLogView"
  107. });
  108. MenuManage.GetInstance.menuModels.Add(new MenuModel()
  109. {
  110. MainMenuIcon = "&#xe668;",
  111. MainMenuName = "消息日志",
  112. Alias = "Message Log",
  113. subMenumodels = InfoLog,
  114. });
  115. #endregion
  116. #region 用户管理
  117. ObservableCollection<SubMenumodel> UserManager = new ObservableCollection<SubMenumodel>();
  118. UserManager.Add(new SubMenumodel()
  119. {
  120. SubMenuName = "用户登录",
  121. AssemblyName = "BPASmartClient.CustomResource",
  122. SubMenuVisibility = Visibility.Visible,
  123. ToggleWindowPath = "Pages.View.SubPagLoginView"
  124. });
  125. UserManager.Add(new SubMenumodel()
  126. {
  127. SubMenuName = "密码修改",
  128. AssemblyName = "BPASmartClient.CustomResource",
  129. SubMenuVisibility = Visibility.Visible,
  130. ToggleWindowPath = "Pages.View.PasswordChangeView"
  131. });
  132. UserManager.Add(new SubMenumodel()
  133. {
  134. SubMenuName = "用户管理",
  135. AssemblyName = "BPASmartClient.CustomResource",
  136. SubMenuVisibility = Visibility.Visible,
  137. ToggleWindowPath = "Pages.View.UserManagerView"
  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 CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
  149. {
  150. Json<ConfigInfoModel>.Save();
  151. Json<CommunicationPar>.Save();
  152. }
  153. protected override void OnExit(ExitEventArgs e)
  154. {
  155. base.OnExit(e);
  156. Json<CommunicationPar>.Save();
  157. }
  158. }
  159. }