From b88868d099ec0d3c57b2e959de0fcee5969c2958 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A6=82=E6=84=8F=20=E5=BD=AD?= <2417589739@qq.com> Date: Thu, 15 Jun 2023 16:07:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=85=E6=B8=B8=E5=AD=A6=E9=99=A2=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BPASmartClient.TourismCollege/App.xaml | 42 +++ BPASmartClient.TourismCollege/App.xaml.cs | 297 ++++++++++++++++++ BPASmartClient.TourismCollege/AssemblyInfo.cs | 10 + .../BPASmartClient.TourismCollege.csproj | 24 ++ BPASmartClient.TourismCollege/GlobalUsing.cs | 21 ++ BPASmartClient.Update/MainWindow.xaml | 29 +- SmartClient.sln | 23 ++ 7 files changed, 438 insertions(+), 8 deletions(-) create mode 100644 BPASmartClient.TourismCollege/App.xaml create mode 100644 BPASmartClient.TourismCollege/App.xaml.cs create mode 100644 BPASmartClient.TourismCollege/AssemblyInfo.cs create mode 100644 BPASmartClient.TourismCollege/BPASmartClient.TourismCollege.csproj create mode 100644 BPASmartClient.TourismCollege/GlobalUsing.cs diff --git a/BPASmartClient.TourismCollege/App.xaml b/BPASmartClient.TourismCollege/App.xaml new file mode 100644 index 00000000..2a8fc2c4 --- /dev/null +++ b/BPASmartClient.TourismCollege/App.xaml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BPASmartClient.TourismCollege/App.xaml.cs b/BPASmartClient.TourismCollege/App.xaml.cs new file mode 100644 index 00000000..346ddae7 --- /dev/null +++ b/BPASmartClient.TourismCollege/App.xaml.cs @@ -0,0 +1,297 @@ +using BPASmartClient.CustomResource.Pages.ViewModel; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using System.Windows; + +namespace BPASmartClient.TourismCollege +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + public static Window MainWindow; + + protected override void OnStartup(StartupEventArgs e) + { + bool createNew; + MessageLog.GetInstance.NotifyShow = new Action(o => + { + DebugLogViewModel.MessageModels.Add(new MessageModel() + { + LogInfo = o, + Forground = System.Windows.Media.Brushes.DeepSkyBlue + }); + }); + MessageLog.GetInstance.NotifyShowEx = new Action(o => + { + DebugLogViewModel.MessageModels.Add(new MessageModel() + { + LogInfo = o, + Forground = System.Windows.Media.Brushes.Red + }); + }); + new EventWaitHandle(false, EventResetMode.AutoReset, "BPASmartClient.TourismCollege", out createNew); + if (!createNew) + { + MessageBox.Show("程序已启动"); + App.Current.Shutdown(); + Environment.Exit(0); + } + base.OnStartup(e); + SystemHelper.GetInstance.CreateDesktopShortcut(); + MenuInit(); + DataInit(); + MainView mv = new MainView(); + mv.TitleName = $"智能炒锅控制系统"; + LoginView lv = new LoginView(); + var res = lv.ShowDialog(); + if (res != null && res == true) + { + BPASmartClient.CustomResource.Pages.Model.MessageNotify.GetInstance.ShowUserLog("用户登录"); + mv.Show(); + } + else + mv.Close(); + MainWindow = mv; + } + + protected override void OnExit(ExitEventArgs e) + { + base.OnExit(e); + BPASmartClient.CustomResource.Pages.Model.MessageNotify.GetInstance.LogSave(); + ThreadManage.GetInstance().Dispose(); + } + + private void MenuInit() + { + NfcServer.GetInstance.Init(); + + #region 配方管理菜单 + ObservableCollection RecipeManage = new ObservableCollection(); + RecipeManage.Add(new SubMenumodel() + { + SubMenuName = "配方管理", + SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 }, + AssemblyName = "BPASmartClient.DosingSystem", + ToggleWindowPath = "View.RecipeSettingsView" + }); + + RecipeManage.Add(new SubMenumodel() + { + SubMenuName = "配方下发", + SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 }, + AssemblyName = "BPASmartClient.DosingSystem", + ToggleWindowPath = "View.RecipeControlView" + }); + + MenuManage.GetInstance.menuModels.Add(new MenuModel() + { + MainMenuIcon = "", + MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 }, + MainMenuName = "配方管理", + Alias = "Recipe Management", + subMenumodels = RecipeManage, + }); + #endregion + + #region 参数设置 + ObservableCollection ParSet = new ObservableCollection(); + ParSet.Add(new SubMenumodel() + { + SubMenuName = "原料参数设置", + SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 }, + AssemblyName = "BPASmartClient.DosingSystem", + ToggleWindowPath = "View.DeviceMaterialParView" + }); + + ParSet.Add(new SubMenumodel() + { + SubMenuName = "设备参数设置", + SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 }, + AssemblyName = "BPASmartClient.DosingSystem", + ToggleWindowPath = "View.CommParSetView" + }); + + //ParSet.Add(new SubMenumodel() + //{ + // SubMenuName = "出料口管理设置", + // SubMenuPermission = new Permission[] { Permission.管理员 }, + // AssemblyName = "BPASmartClient.DosingSystem", + // ToggleWindowPath = "View.OutletManagementView" + //}); + + MenuManage.GetInstance.menuModels.Add(new MenuModel() + { + MainMenuIcon = "", + MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 }, + MainMenuName = "参数设置", + Alias = "Parameter Set", + subMenumodels = ParSet, + }); + #endregion + + #region 手动控制 + ObservableCollection ManualControl = new ObservableCollection(); + ManualControl.Add(new SubMenumodel() + { + SubMenuName = "气缸手动控制", + SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 }, + AssemblyName = "BPASmartClient.DosingSystem", + ToggleWindowPath = "View.ManualControlView" + }); + + ManualControl.Add(new SubMenumodel() + { + SubMenuName = "输送带手动控制", + SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 }, + AssemblyName = "BPASmartClient.DosingSystem", + ToggleWindowPath = "View.ConveyerBeltManualView" + }); + + ManualControl.Add(new SubMenumodel() + { + SubMenuName = "配料输送带控制", + SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 }, + AssemblyName = "BPASmartClient.DosingSystem", + ToggleWindowPath = "View.TempManageControlView" + }); + + //ManualControl.Add(new SubMenumodel() + //{ + // SubMenuName = "料仓控制", + // SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, + // AssemblyName = "BPASmartClient.DosingSystem", + // ToggleWindowPath = "View.StockControlView" + //}); + MenuManage.GetInstance.menuModels.Add(new MenuModel() + { + MainMenuIcon = "", + MainMenuName = "手动控制", + MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 }, + Alias = "Parameter Set", + subMenumodels = ManualControl, + }); + #endregion + + #region 消息日志 + ObservableCollection InfoLog = new ObservableCollection(); + InfoLog.Add(new SubMenumodel() + { + SubMenuName = "操作日志", + SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 }, + AssemblyName = "BPASmartClient.CustomResource", + ToggleWindowPath = "Pages.View.UserLogView" + }); + + InfoLog.Add(new SubMenumodel() + { + SubMenuName = "运行日志", + SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 }, + AssemblyName = "BPASmartClient.CustomResource", + ToggleWindowPath = "Pages.View.RunLogView" + }); + + InfoLog.Add(new SubMenumodel() + { + SubMenuName = "报警记录", + SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 }, + AssemblyName = "BPASmartClient.CustomResource", + ToggleWindowPath = "Pages.View.AlarmView" + }); + + InfoLog.Add(new SubMenumodel() + { + SubMenuName = "调试日志", + SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 }, + AssemblyName = "BPASmartClient.CustomResource", + ToggleWindowPath = "Pages.View.DebugLogView" + }); + + MenuManage.GetInstance.menuModels.Add(new MenuModel() + { + MainMenuIcon = "", + MainMenuName = "消息日志", + MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 }, + Alias = "Message Log", + subMenumodels = InfoLog, + }); + #endregion + + #region 硬件设备监控 + ObservableCollection DeviceMonitor = new ObservableCollection(); + DeviceMonitor.Add(new SubMenumodel() + { + SubMenuName = "原料设备列表", + SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 }, + AssemblyName = "BPASmartClient.DosingSystem", + ToggleWindowPath = "View.DeviceListView" + }); + + DeviceMonitor.Add(new SubMenumodel() + { + SubMenuName = "设备状态", + SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 }, + AssemblyName = "BPASmartClient.DosingSystem", + ToggleWindowPath = "View.HardwareStatusView" + }); + + MenuManage.GetInstance.menuModels.Add(new MenuModel() + { + MainMenuIcon = "", + MainMenuName = "设备监控", + MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 }, + Alias = "Device Monitor", + subMenumodels = DeviceMonitor, + }); + #endregion + + #region 用户管理 + ObservableCollection UserManager = new ObservableCollection(); + UserManager.Add(new SubMenumodel() + { + SubMenuName = "用户登录", + SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 }, + AssemblyName = "BPASmartClient.CustomResource", + ToggleWindowPath = "Pages.View.SubPagLoginView" + }); + + UserManager.Add(new SubMenumodel() + { + SubMenuName = "密码修改", + SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 }, + AssemblyName = "BPASmartClient.CustomResource", + ToggleWindowPath = "Pages.View.PasswordChangeView" + }); + UserManager.Add(new SubMenumodel() + { + SubMenuName = "用户管理", + SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 }, + AssemblyName = "BPASmartClient.CustomResource", + ToggleWindowPath = "Pages.View.UserManagerView" + }); + + MenuManage.GetInstance.menuModels.Add(new MenuModel() + { + MainMenuIcon = "", + MainMenuName = "用户管理", + MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 }, + Alias = "User Management", + subMenumodels = UserManager, + }); + #endregion + } + + private void DataInit() + { + + } + + } +} diff --git a/BPASmartClient.TourismCollege/AssemblyInfo.cs b/BPASmartClient.TourismCollege/AssemblyInfo.cs new file mode 100644 index 00000000..8b5504ec --- /dev/null +++ b/BPASmartClient.TourismCollege/AssemblyInfo.cs @@ -0,0 +1,10 @@ +using System.Windows; + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/BPASmartClient.TourismCollege/BPASmartClient.TourismCollege.csproj b/BPASmartClient.TourismCollege/BPASmartClient.TourismCollege.csproj new file mode 100644 index 00000000..079995df --- /dev/null +++ b/BPASmartClient.TourismCollege/BPASmartClient.TourismCollege.csproj @@ -0,0 +1,24 @@ + + + + WinExe + net6.0-windows + enable + true + + + + + + + + + + + + + + + + + diff --git a/BPASmartClient.TourismCollege/GlobalUsing.cs b/BPASmartClient.TourismCollege/GlobalUsing.cs new file mode 100644 index 00000000..419dd12c --- /dev/null +++ b/BPASmartClient.TourismCollege/GlobalUsing.cs @@ -0,0 +1,21 @@ +global using System; +global using System.Collections.Generic; +global using System.Collections.ObjectModel; +global using System.Configuration; +global using System.Data; +global using System.Linq; +global using System.Threading; +global using System.Threading.Tasks; +global using System.Windows; +global using System.Diagnostics; +global using System.IO; +global using System.Drawing; +global using System.Windows.Media; +global using BPA.Helper; +global using BPA.Communication; +global using BPASmartClient.CustomResource.Pages.Enums; +global using BPASmartClient.CustomResource.Pages.Model; +global using BPASmartClient.CustomResource.Pages.View; +global using BPASmartClient.CustomResource.Pages.ViewModel; + + diff --git a/BPASmartClient.Update/MainWindow.xaml b/BPASmartClient.Update/MainWindow.xaml index 004b2e85..0f8afdad 100644 --- a/BPASmartClient.Update/MainWindow.xaml +++ b/BPASmartClient.Update/MainWindow.xaml @@ -19,7 +19,7 @@ - + @@ -30,13 +30,26 @@ Text="{Binding um.UpdateDescription}" TextWrapping="Wrap" /> - + - - + + - - + + @@ -49,17 +62,17 @@ Grid.Column="0" Width="100" Background="DeepSkyBlue" - Click="cancel_Click" BorderThickness="0" + Click="cancel_Click" Content="取消更新" Foreground="#272727" />