|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 |
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Configuration;
- using System.Data;
- using System.Linq;
- using System.Threading.Tasks;
- using System.Windows;
- using BPA.Helper;
- using BPASmartClient.CustomResource.Pages.Enums;
- using BPASmartClient.CustomResource.Pages.Model;
- using BPASmartClient.CustomResource.Pages.View;
-
- namespace BPASmartClient.SmallBatchingSystem
- {
- /// <summary>
- /// Interaction logic for App.xaml
- /// </summary>
- public partial class App : Application
- {
- public static Window MainWindow;
- protected override void OnStartup(StartupEventArgs e)
- {
- //1366*768
- base.OnStartup(e);
- SystemHelper.GetInstance.CreateDesktopShortcut();
- AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
- Json<ConfigInfoModel>.Read();
- Json<CommunicationPar>.Read();
- MenuInit();
- MainView mv = new MainView();
- Control.GetInstance.Init();
- mv.TitleName = "黑菠萝自动化配料系统";
- //mv.Show();
- LoginView lv = new LoginView();
- var res = lv.ShowDialog();
- if (res != null && res == true)
- {
- Control.GetInstance.OperationLog("用户登录");
- mv.Show();
- }
- else
- mv.Close();
- MainWindow = mv;
- }
-
- private void MenuInit()
- {
- #region 配方管理菜单
- ObservableCollection<SubMenumodel> RecipeManage = new ObservableCollection<SubMenumodel>();
- RecipeManage.Add(new SubMenumodel()
- {
- SubMenuName = "料仓管理",
- AssemblyName = "BPASmartClient.SmallBatchingSystem",
- SubMenuVisibility = Visibility.Visible,
- ToggleWindowPath = "Views.SiloManagementView"
- });
-
- RecipeManage.Add(new SubMenumodel()
- {
- SubMenuName = "出料口管理",
- AssemblyName = "BPASmartClient.SmallBatchingSystem",
- SubMenuVisibility = Visibility.Visible,
- ToggleWindowPath = "Views.OutletManagementView"
- });
-
- RecipeManage.Add(new SubMenumodel()
- {
- SubMenuName = "配方管理",
- AssemblyName = "BPASmartClient.SmallBatchingSystem",
- SubMenuVisibility = Visibility.Visible,
- ToggleWindowPath = "Views.RecipeView"
- });
-
- RecipeManage.Add(new SubMenumodel()
- {
- SubMenuName = "配方下发",
- AssemblyName = "BPASmartClient.SmallBatchingSystem",
- SubMenuVisibility = Visibility.Visible,
- ToggleWindowPath = "Views.RecipeControlView"
- });
-
-
-
- MenuManage.GetInstance.menuModels.Add(new MenuModel()
- {
- MainMenuIcon = "",
- MainMenuName = "配方管理",
- Alias = "Recipe Management",
- subMenumodels = RecipeManage,
- });
- #endregion
-
- #region 消息日志
- ObservableCollection<SubMenumodel> InfoLog = new ObservableCollection<SubMenumodel>();
- InfoLog.Add(new SubMenumodel()
- {
- SubMenuName = "操作日志",
- AssemblyName = "BPASmartClient.CustomResource",
- SubMenuVisibility = Visibility.Visible,
- ToggleWindowPath = "Pages.View.UserLogView"
- });
-
- InfoLog.Add(new SubMenumodel()
- {
- SubMenuName = "运行日志",
- AssemblyName = "BPASmartClient.CustomResource",
- SubMenuVisibility = Visibility.Visible,
- ToggleWindowPath = "Pages.View.RunLogView"
- });
-
- InfoLog.Add(new SubMenumodel()
- {
- SubMenuName = "调试日志",
- AssemblyName = "BPASmartClient.CustomResource",
- SubMenuVisibility = Visibility.Visible,
- ToggleWindowPath = "Pages.View.DebugLogView"
- });
-
- MenuManage.GetInstance.menuModels.Add(new MenuModel()
- {
- MainMenuIcon = "",
- MainMenuName = "消息日志",
- Alias = "Message Log",
- subMenumodels = InfoLog,
- });
- #endregion
-
- #region 用户管理
- ObservableCollection<SubMenumodel> UserManager = new ObservableCollection<SubMenumodel>();
- UserManager.Add(new SubMenumodel()
- {
- SubMenuName = "用户登录",
- AssemblyName = "BPASmartClient.CustomResource",
- SubMenuVisibility = Visibility.Visible,
- ToggleWindowPath = "Pages.View.SubPagLoginView"
- });
-
- UserManager.Add(new SubMenumodel()
- {
- SubMenuName = "密码修改",
- AssemblyName = "BPASmartClient.CustomResource",
- SubMenuVisibility = Visibility.Visible,
- ToggleWindowPath = "Pages.View.PasswordChangeView"
- });
- UserManager.Add(new SubMenumodel()
- {
- SubMenuName = "用户管理",
- AssemblyName = "BPASmartClient.CustomResource",
- SubMenuVisibility = Visibility.Visible,
- ToggleWindowPath = "Pages.View.UserManagerView"
- });
-
- MenuManage.GetInstance.menuModels.Add(new MenuModel()
- {
- MainMenuIcon = "",
- MainMenuName = "用户管理",
- Alias = "User Management",
- subMenumodels = UserManager,
- });
- #endregion
- }
-
- private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
- {
- Json<ConfigInfoModel>.Save();
- Json<CommunicationPar>.Save();
- }
-
- protected override void OnExit(ExitEventArgs e)
- {
- base.OnExit(e);
- Json<CommunicationPar>.Save();
- }
- }
- }
|