From 21addffdde4faf325888e2858090c1d215ac876e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Chsc=E2=80=9D?= <“huangsucan@kaiyili-lab.com”> Date: Fri, 21 Aug 2026 16:09:53 +0800 Subject: [PATCH] =?UTF-8?q?IOT=E7=BA=AF=E5=90=8E=E7=AB=AF=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DeviceCommand/DeviceCommand.csproj | 1 + DeviceCommand/Devices/Others.cs | 108 --- DeviceCommand/Devices/THC-1100-602A.cs | 2 +- IOT.sln | 54 +- .../Controllers/EnovaDataController.cs | 0 .../WebAPI.csproj => IOT_API/IOT_API.csproj | 2 +- {WebAPI => IOT_API}/Program.cs | 0 .../Properties/launchSettings.json | 0 {WebAPI => IOT_API}/WebAPI.http | 0 .../appsettings.Development.json | 0 {WebAPI => IOT_API}/appsettings.json | 0 LOT/App.xaml | 15 - LOT/App.xaml.cs | 82 -- LOT/AssemblyInfo.cs | 10 - LOT/LOT.csproj | 67 -- LOT/Resources/Images/error.png | Bin 7146 -> 0 bytes LOT/Resources/Images/info.png | Bin 5521 -> 0 bytes LOT/Resources/Images/warning.png | Bin 5216 -> 0 bytes LOT/ViewModels/Dialogs/MessageBoxViewModel.cs | 120 --- LOT/ViewModels/ShellViewModel.cs | 109 --- LOT/Views/Dialogs/MessageBoxView.xaml | 87 -- LOT/Views/Dialogs/MessageBoxView.xaml.cs | 36 - LOT/Views/LoginModuleView.xaml | 21 - LOT/Views/LoginModuleView.xaml.cs | 38 - LOT/Views/ShellView.xaml | 188 ---- LOT/Views/ShellView.xaml.cs | 51 -- Logger/LoggerHelper.cs | 8 + LoginModule/LoginModule.cs | 21 - LoginModule/LoginModule.csproj | 12 - LoginModule/ViewModels/LoginViewModel.cs | 48 - LoginModule/ViewModels/RegisterViewModel.cs | 51 -- LoginModule/Views/LoginView.xaml | 163 ---- LoginModule/Views/LoginView.xaml.cs | 28 - LoginModule/Views/RegisterView.xaml | 175 ---- LoginModule/Views/RegisterView.xaml.cs | 28 - MainModule/Events/ConnectionConfigEvent.cs | 35 - MainModule/MainModule.cs | 22 - MainModule/MainModule.csproj | 23 - .../ViewModels/ConnectionConfigViewModel.cs | 237 ----- MainModule/ViewModels/MainViewModel.cs | 846 ------------------ MainModule/Views/ConnectionConfigView.xaml | 285 ------ MainModule/Views/ConnectionConfigView.xaml.cs | 18 - MainModule/Views/MainView.xaml | 163 ---- MainModule/Views/MainView.xaml.cs | 30 - SettingModule/SettingModule.cs | 19 - SettingModule/SettingModule.csproj | 23 - SettingModule/ViewModels/SettingViewModel.cs | 28 - SettingModule/Views/SettingView.xaml | 15 - SettingModule/Views/SettingView.xaml.cs | 28 - .../BooleanToVisibilityConverter.cs | 36 - UIShare/Helpers/PasswordBoxHelper.cs | 52 -- UIShare/PubEvent/LoginSuccessEvent.cs | 12 - UIShare/PubEvent/OverlayEvent.cs | 12 - UIShare/PubEvent/WaitingEvent.cs | 12 - UIShare/Styles/CommonStyle.xaml | 21 - UIShare/Styles/WindowStyle.xaml | 22 - UIShare/UIShare.csproj | 20 - UIShare/ViewModelBase/DialogViewModelBase.cs | 27 - .../ViewModelBase/NavigateViewModelBase.cs | 60 -- UpdateInfoModule/UpdateInfoModule.cs | 19 - UpdateInfoModule/UpdateInfoModule.csproj | 20 - .../ViewModels/UpdateInfoViewModel.cs | 30 - UpdateInfoModule/Views/UpdateInfoView.xaml | 15 - UpdateInfoModule/Views/UpdateInfoView.xaml.cs | 28 - 64 files changed, 16 insertions(+), 3667 deletions(-) delete mode 100644 DeviceCommand/Devices/Others.cs rename {WebAPI => IOT_API}/Controllers/EnovaDataController.cs (100%) rename WebAPI/WebAPI.csproj => IOT_API/IOT_API.csproj (87%) rename {WebAPI => IOT_API}/Program.cs (100%) rename {WebAPI => IOT_API}/Properties/launchSettings.json (100%) rename {WebAPI => IOT_API}/WebAPI.http (100%) rename {WebAPI => IOT_API}/appsettings.Development.json (100%) rename {WebAPI => IOT_API}/appsettings.json (100%) delete mode 100644 LOT/App.xaml delete mode 100644 LOT/App.xaml.cs delete mode 100644 LOT/AssemblyInfo.cs delete mode 100644 LOT/LOT.csproj delete mode 100644 LOT/Resources/Images/error.png delete mode 100644 LOT/Resources/Images/info.png delete mode 100644 LOT/Resources/Images/warning.png delete mode 100644 LOT/ViewModels/Dialogs/MessageBoxViewModel.cs delete mode 100644 LOT/ViewModels/ShellViewModel.cs delete mode 100644 LOT/Views/Dialogs/MessageBoxView.xaml delete mode 100644 LOT/Views/Dialogs/MessageBoxView.xaml.cs delete mode 100644 LOT/Views/LoginModuleView.xaml delete mode 100644 LOT/Views/LoginModuleView.xaml.cs delete mode 100644 LOT/Views/ShellView.xaml delete mode 100644 LOT/Views/ShellView.xaml.cs delete mode 100644 LoginModule/LoginModule.cs delete mode 100644 LoginModule/LoginModule.csproj delete mode 100644 LoginModule/ViewModels/LoginViewModel.cs delete mode 100644 LoginModule/ViewModels/RegisterViewModel.cs delete mode 100644 LoginModule/Views/LoginView.xaml delete mode 100644 LoginModule/Views/LoginView.xaml.cs delete mode 100644 LoginModule/Views/RegisterView.xaml delete mode 100644 LoginModule/Views/RegisterView.xaml.cs delete mode 100644 MainModule/Events/ConnectionConfigEvent.cs delete mode 100644 MainModule/MainModule.cs delete mode 100644 MainModule/MainModule.csproj delete mode 100644 MainModule/ViewModels/ConnectionConfigViewModel.cs delete mode 100644 MainModule/ViewModels/MainViewModel.cs delete mode 100644 MainModule/Views/ConnectionConfigView.xaml delete mode 100644 MainModule/Views/ConnectionConfigView.xaml.cs delete mode 100644 MainModule/Views/MainView.xaml delete mode 100644 MainModule/Views/MainView.xaml.cs delete mode 100644 SettingModule/SettingModule.cs delete mode 100644 SettingModule/SettingModule.csproj delete mode 100644 SettingModule/ViewModels/SettingViewModel.cs delete mode 100644 SettingModule/Views/SettingView.xaml delete mode 100644 SettingModule/Views/SettingView.xaml.cs delete mode 100644 UIShare/Converters/BooleanToVisibilityConverter.cs delete mode 100644 UIShare/Helpers/PasswordBoxHelper.cs delete mode 100644 UIShare/PubEvent/LoginSuccessEvent.cs delete mode 100644 UIShare/PubEvent/OverlayEvent.cs delete mode 100644 UIShare/PubEvent/WaitingEvent.cs delete mode 100644 UIShare/Styles/CommonStyle.xaml delete mode 100644 UIShare/Styles/WindowStyle.xaml delete mode 100644 UIShare/UIShare.csproj delete mode 100644 UIShare/ViewModelBase/DialogViewModelBase.cs delete mode 100644 UIShare/ViewModelBase/NavigateViewModelBase.cs delete mode 100644 UpdateInfoModule/UpdateInfoModule.cs delete mode 100644 UpdateInfoModule/UpdateInfoModule.csproj delete mode 100644 UpdateInfoModule/ViewModels/UpdateInfoViewModel.cs delete mode 100644 UpdateInfoModule/Views/UpdateInfoView.xaml delete mode 100644 UpdateInfoModule/Views/UpdateInfoView.xaml.cs diff --git a/DeviceCommand/DeviceCommand.csproj b/DeviceCommand/DeviceCommand.csproj index 6c99400..c0031e7 100644 --- a/DeviceCommand/DeviceCommand.csproj +++ b/DeviceCommand/DeviceCommand.csproj @@ -14,6 +14,7 @@ + diff --git a/DeviceCommand/Devices/Others.cs b/DeviceCommand/Devices/Others.cs deleted file mode 100644 index 8de9646..0000000 --- a/DeviceCommand/Devices/Others.cs +++ /dev/null @@ -1,108 +0,0 @@ -using DeviceCommand.Base; - -public class Others : ModbusTcp -{ - private readonly byte _slaveId; - - /// - /// 通道1PV - /// - private const ushort CH1_PV = 100; - - /// - /// 通道2PV - /// - private const ushort CH2_PV = 102; - - /// - /// 通道3PV - /// - private const ushort CH3_PV = 104; - - /// - /// 通道4PV - /// - private const ushort CH4_PV = 106; - - public Others( - byte slaveId, - string ip, - int port = 508, - int sendTimeoutMs = 3000, - int receiveTimeoutMs = 3000) - : base() - { - _slaveId = slaveId; - ConfigureDevice(ip, port, sendTimeoutMs, receiveTimeoutMs); - } - - /// - /// 读取通道1PV - /// - public async Task ReadCH1Async(CancellationToken ct = default) - { - return await ReadRealAsync(CH1_PV, ct); - } - - /// - /// 读取通道2PV - /// - public async Task ReadCH2Async(CancellationToken ct = default) - { - return await ReadRealAsync(CH2_PV, ct); - } - - /// - /// 读取通道3PV - /// - public async Task ReadCH3Async(CancellationToken ct = default) - { - return await ReadRealAsync(CH3_PV, ct); - } - - /// - /// 读取通道4PV - /// - public async Task ReadCH4Async(CancellationToken ct = default) - { - return await ReadRealAsync(CH4_PV, ct); - } - - /// - /// 一次读取4个通道PV - /// - public async Task<(float ch1, float ch2, float ch3, float ch4)> ReadAllAsync(CancellationToken ct = default) - { - ushort[] raw = await ReadHoldingRegistersAsync(_slaveId, 100, 8, ct); - - return - ( - ToFloat(raw[0], raw[1]), - ToFloat(raw[2], raw[3]), - ToFloat(raw[4], raw[5]), - ToFloat(raw[6], raw[7]) - ); - } - - private async Task ReadRealAsync(ushort address, CancellationToken ct) - { - ushort[] raw = await ReadHoldingRegistersAsync(_slaveId, address, 2, ct); - return ToFloat(raw[0], raw[1]); - } - - private static float ToFloat(ushort high, ushort low) - { - byte[] bytes = - { - (byte)(high >> 8), - (byte)high, - (byte)(low >> 8), - (byte)low - }; - - if (BitConverter.IsLittleEndian) - Array.Reverse(bytes); - - return BitConverter.ToSingle(bytes, 0); - } -} \ No newline at end of file diff --git a/DeviceCommand/Devices/THC-1100-602A.cs b/DeviceCommand/Devices/THC-1100-602A.cs index 5d1d968..4b3a3f4 100644 --- a/DeviceCommand/Devices/THC-1100-602A.cs +++ b/DeviceCommand/Devices/THC-1100-602A.cs @@ -13,7 +13,7 @@ namespace DeviceCommand.Devices public class THC1100 : S7Device { #region THC设备默认连接参数 - private const string DefaultIpAddress = "192.168.0.1"; + private const string DefaultIpAddress = "192.168.1.3"; private const CpuType DefaultCpuType = CpuType.S71200; private const short DefaultRack = 0; private const short DefaultSlot = 1; diff --git a/IOT.sln b/IOT.sln index 1f279c3..02cf8f5 100644 --- a/IOT.sln +++ b/IOT.sln @@ -13,23 +13,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Service", "Service\Service. EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "Common\Common.csproj", "{C769E6C6-55E9-40C3-A611-9EFAB101BE6A}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Module", "Module", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoginModule", "LoginModule\LoginModule.csproj", "{F79AC87E-7A5A-486F-BE6C-51E81CA569E4}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UIShare", "UIShare\UIShare.csproj", "{F7A7D4FA-974C-470F-9543-0B256640BD81}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SettingModule", "SettingModule\SettingModule.csproj", "{2C3C2DBB-F782-416B-8571-07D3F533820B}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UpdateInfoModule", "UpdateInfoModule\UpdateInfoModule.csproj", "{B99017CA-BB14-426A-BBF0-C0C05C6510CA}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MainModule", "MainModule\MainModule.csproj", "{715852A3-D2DE-4C2E-AEF2-2BC0ADBEAC0A}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LOT", "LOT\LOT.csproj", "{01E01684-DDE8-4B00-9BFC-2C5CDB2A261F}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeviceCommand", "DeviceCommand\DeviceCommand.csproj", "{2F035F70-5F1D-4C22-B4F0-1AEA0ED127A6}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebAPI", "WebAPI\WebAPI.csproj", "{D12C03C6-91F1-4792-9787-1EBD98E349EF}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IOT_API", "IOT_API\IOT_API.csproj", "{1E2A7C73-2CAE-4084-939B-0F8EE73AA955}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -57,48 +43,18 @@ Global {C769E6C6-55E9-40C3-A611-9EFAB101BE6A}.Debug|Any CPU.Build.0 = Debug|Any CPU {C769E6C6-55E9-40C3-A611-9EFAB101BE6A}.Release|Any CPU.ActiveCfg = Release|Any CPU {C769E6C6-55E9-40C3-A611-9EFAB101BE6A}.Release|Any CPU.Build.0 = Release|Any CPU - {F79AC87E-7A5A-486F-BE6C-51E81CA569E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F79AC87E-7A5A-486F-BE6C-51E81CA569E4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F79AC87E-7A5A-486F-BE6C-51E81CA569E4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F79AC87E-7A5A-486F-BE6C-51E81CA569E4}.Release|Any CPU.Build.0 = Release|Any CPU - {F7A7D4FA-974C-470F-9543-0B256640BD81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F7A7D4FA-974C-470F-9543-0B256640BD81}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F7A7D4FA-974C-470F-9543-0B256640BD81}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F7A7D4FA-974C-470F-9543-0B256640BD81}.Release|Any CPU.Build.0 = Release|Any CPU - {2C3C2DBB-F782-416B-8571-07D3F533820B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2C3C2DBB-F782-416B-8571-07D3F533820B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2C3C2DBB-F782-416B-8571-07D3F533820B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2C3C2DBB-F782-416B-8571-07D3F533820B}.Release|Any CPU.Build.0 = Release|Any CPU - {B99017CA-BB14-426A-BBF0-C0C05C6510CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B99017CA-BB14-426A-BBF0-C0C05C6510CA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B99017CA-BB14-426A-BBF0-C0C05C6510CA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B99017CA-BB14-426A-BBF0-C0C05C6510CA}.Release|Any CPU.Build.0 = Release|Any CPU - {715852A3-D2DE-4C2E-AEF2-2BC0ADBEAC0A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {715852A3-D2DE-4C2E-AEF2-2BC0ADBEAC0A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {715852A3-D2DE-4C2E-AEF2-2BC0ADBEAC0A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {715852A3-D2DE-4C2E-AEF2-2BC0ADBEAC0A}.Release|Any CPU.Build.0 = Release|Any CPU - {01E01684-DDE8-4B00-9BFC-2C5CDB2A261F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {01E01684-DDE8-4B00-9BFC-2C5CDB2A261F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {01E01684-DDE8-4B00-9BFC-2C5CDB2A261F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {01E01684-DDE8-4B00-9BFC-2C5CDB2A261F}.Release|Any CPU.Build.0 = Release|Any CPU {2F035F70-5F1D-4C22-B4F0-1AEA0ED127A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2F035F70-5F1D-4C22-B4F0-1AEA0ED127A6}.Debug|Any CPU.Build.0 = Debug|Any CPU {2F035F70-5F1D-4C22-B4F0-1AEA0ED127A6}.Release|Any CPU.ActiveCfg = Release|Any CPU {2F035F70-5F1D-4C22-B4F0-1AEA0ED127A6}.Release|Any CPU.Build.0 = Release|Any CPU - {D12C03C6-91F1-4792-9787-1EBD98E349EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D12C03C6-91F1-4792-9787-1EBD98E349EF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D12C03C6-91F1-4792-9787-1EBD98E349EF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D12C03C6-91F1-4792-9787-1EBD98E349EF}.Release|Any CPU.Build.0 = Release|Any CPU + {1E2A7C73-2CAE-4084-939B-0F8EE73AA955}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1E2A7C73-2CAE-4084-939B-0F8EE73AA955}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1E2A7C73-2CAE-4084-939B-0F8EE73AA955}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1E2A7C73-2CAE-4084-939B-0F8EE73AA955}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {F79AC87E-7A5A-486F-BE6C-51E81CA569E4} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8} - {2C3C2DBB-F782-416B-8571-07D3F533820B} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8} - {B99017CA-BB14-426A-BBF0-C0C05C6510CA} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8} - {715852A3-D2DE-4C2E-AEF2-2BC0ADBEAC0A} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8} - EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {22BD9235-6581-454D-97D8-F4E932F80888} EndGlobalSection diff --git a/WebAPI/Controllers/EnovaDataController.cs b/IOT_API/Controllers/EnovaDataController.cs similarity index 100% rename from WebAPI/Controllers/EnovaDataController.cs rename to IOT_API/Controllers/EnovaDataController.cs diff --git a/WebAPI/WebAPI.csproj b/IOT_API/IOT_API.csproj similarity index 87% rename from WebAPI/WebAPI.csproj rename to IOT_API/IOT_API.csproj index b57eda5..794d4bb 100644 --- a/WebAPI/WebAPI.csproj +++ b/IOT_API/IOT_API.csproj @@ -11,8 +11,8 @@ - + diff --git a/WebAPI/Program.cs b/IOT_API/Program.cs similarity index 100% rename from WebAPI/Program.cs rename to IOT_API/Program.cs diff --git a/WebAPI/Properties/launchSettings.json b/IOT_API/Properties/launchSettings.json similarity index 100% rename from WebAPI/Properties/launchSettings.json rename to IOT_API/Properties/launchSettings.json diff --git a/WebAPI/WebAPI.http b/IOT_API/WebAPI.http similarity index 100% rename from WebAPI/WebAPI.http rename to IOT_API/WebAPI.http diff --git a/WebAPI/appsettings.Development.json b/IOT_API/appsettings.Development.json similarity index 100% rename from WebAPI/appsettings.Development.json rename to IOT_API/appsettings.Development.json diff --git a/WebAPI/appsettings.json b/IOT_API/appsettings.json similarity index 100% rename from WebAPI/appsettings.json rename to IOT_API/appsettings.json diff --git a/LOT/App.xaml b/LOT/App.xaml deleted file mode 100644 index f6038fd..0000000 --- a/LOT/App.xaml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - diff --git a/LOT/App.xaml.cs b/LOT/App.xaml.cs deleted file mode 100644 index d5b131a..0000000 --- a/LOT/App.xaml.cs +++ /dev/null @@ -1,82 +0,0 @@ -using Castle.DynamicProxy; -using Common; -using LOT.ViewModels; -using LOT.ViewModels.Dialogs; -using LOT.Views; -using LOT.Views; -using LOT.Views.Dialogs; -using Logger; -using Notifications.Wpf.Core; -using ORM; -using Service.Implement; -using Service.Interface; -using System.Configuration; -using System.Data; -using System.Reflection; -using System.Windows; -using UIShare.PubEvent; -using static System.Runtime.InteropServices.JavaScript.JSType; - -namespace LOT -{ - /// - /// Interaction logic for App.xaml - /// - public partial class App : PrismApplication - { - protected override Window CreateShell() - { - //UI线程未捕获异常处理事件 - this.DispatcherUnhandledException += OnDispatcherUnhandledException; - //Task线程内未捕获异常处理事件 - TaskScheduler.UnobservedTaskException += OnUnobservedTaskException; - ////多线程异常 - AppDomain.CurrentDomain.UnhandledException += OnUnhandledException; - return Container.Resolve(); - } - private void OnDispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) - { - LoggerHelper.Error(e.Exception.Message,e.Exception.StackTrace); - } - - private void OnUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e) - { - LoggerHelper.Error(e.Exception.Message, e.Exception.StackTrace); - } - - private void OnUnhandledException(object sender, UnhandledExceptionEventArgs e) - { - //记录dump文件 - Exception ex = e.ExceptionObject as Exception; - MiniDump.TryDump($"dumps\\Error_{DateTime.Now:yyyy-MM-dd HH-mm-ss-ms}.dmp", MiniDump.Option.WithFullMemory, ex); - } - protected override void OnInitialized() - { - //初始化数据库 - //DatabaseConfig.SetTenant(10001); - //DatabaseConfig.InitMySql("127.0.0.1",3306,"LOT","root","123456"); - //DatabaseConfig.CreateDatabaseAndCheckConnection(createDatabase: true, checkConnection: true); - //SqlSugarContext.InitDatabase(); - //显示登录窗口 - var login=Container.Resolve(); - var re=Container.Resolve(); - RegionManager.SetRegionManager(login, re); - RegionManager.SetRegionManager(Application.Current.MainWindow, re); - login.Show(); - } - protected override void RegisterTypes(IContainerRegistry containerRegistry) - { - //注册弹窗 - containerRegistry.RegisterDialog("MessageBox"); - // 注册通知管理器 - INotificationManager NotificationManager = new NotificationManager(); - containerRegistry.RegisterInstance(NotificationManager); - } - //指定模块加载方式(需要手动将模块生成的dll放入Modules文件夹中) - protected override IModuleCatalog CreateModuleCatalog() - { - //指定模块加载方式为从文件夹中以反射发现并加载module(推荐用法) - return new DirectoryModuleCatalog() { ModulePath = @".\Modules" }; - } - } -} diff --git a/LOT/AssemblyInfo.cs b/LOT/AssemblyInfo.cs deleted file mode 100644 index b0ec827..0000000 --- a/LOT/AssemblyInfo.cs +++ /dev/null @@ -1,10 +0,0 @@ -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/LOT/LOT.csproj b/LOT/LOT.csproj deleted file mode 100644 index cd8ca8e..0000000 --- a/LOT/LOT.csproj +++ /dev/null @@ -1,67 +0,0 @@ - - - - WinExe - net8.0-windows - enable - enable - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - - diff --git a/LOT/Resources/Images/error.png b/LOT/Resources/Images/error.png deleted file mode 100644 index de079d0b7e0670dac8c52f5ace3adf9772b4b381..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7146 zcmV_rb?+X$%CG(>Jf)qiv zOE4)CpA9_hZUB;UqkpqY;B)b=Ksea&`)_xj8Q#DB`*R)s`~K}GhA+SW_Q=3<7i=8H zccFM!<%8qw71sic0upHuVDJ-y!VP{7bQ|8kEwj_<8R5}}Ec=u(7;~T1p)}@>!DQKi zf#)t{jKlaYoK96fIDSFi2+u5sK-sbZ4(k%BS-a0h0SOoa9DoQ1KHWJuF-RQ*&u;K@ zpxY3Tzh{zy^; zatj9zfGH84EilkBxTi0H1Qd`SA+>?Pz^XI^%$*ej(bJN%%M~!tGHBC_hEZV7gw%dB zBOvW!(l~FRc>k6@!}H2D#8jcaXqXxpYDmc7Fg4>XrQbau7!c>C6Sagf96V-ce+3^1 zG##m32+Pje-`U*V0^-2HfY`dG=Kk$dv(y)x8?6LQp8v)zxr@3Z)5%P!Q}ycIFkq zIGVD2!c^-=8}j_Nd9(xlSpb{{6ziuH?>0HHu_-_n1mkF7Fyw0IQSq_*6 z6l(8vNg}*9$pb>I!TnI&hZHV`&Xg4t@ENEfQUIc}6|IY%z(5POqQp40rk9=d+Q15Z z(tz+uMXeEY`v*pd1*3riJ_D|8@@0X67CbY>;L5{~hGr2ceJ zaQ5hi+9FcENn~R|sZB8lODrd!edIt%LKqj7ObQTyQCM^8bb7pKN9fxl2E?t?7NMDJ zDV>AGIr$ji4-wkeHoKCV?Mem^z;VEn=sAix#kGk%zp-F!*o2xoun7xi=kO4@i3SQD zZZwUj)@`ZuNdQ8D0*>ig!-2uIiR1UdHHf7;Acb<;pkPY(eQY&+N z3)&KDvaZ_XS{)#EmTH1Y1=amvoo~$Vqto=YfCRX`1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I*CAJL)uPkwtEQWed7qW!~`NDGF`4$IC+@ziHcF*<5P`WM08>jWO9g~E22K9H{}O?DAb@`P;(YfA{nRIVe9Ld>R;~@PHJAal>Aw<>>Z%oyStmdfQXWf!GCO}}AB1JjWT2MC#f})of>j&~qk_ZSqqCw!eP!5#`t`Ma7Q4~xqlB5C`FNB9c zdb-*f{6hfbcnpiFvFf!1fiyJ9YUlCgh62!*e+iOhvD>TLd z`meQeCW2hg9EIg%c??$GMJ2?s&xj*(2Otkm_lOt_hXMK-&TOz2>jwP~C;FnC;$w8* zYpgXvq+*o=jy;GYmCNRpK_H%I4~fAr7@(iwM4!Wn{)e;DF*{u7l^`AJ!K6fBmI(Ak zkXb$)D@6plB0z$4MUd%(Mt}qfx_S9@ zJpv?1d+eAp0t85q2pXA>*d75Aq&;>_836($NCb_{M{JKk+yrTl8&gJt00|OFL-R4) zAwYt(!;PsTL4X8_q@nqk?GPYA+Tq4jksv^V4AjufHVg#500030|HY(2RsaA121!Ig aR09BF1iD2y*bf%~0000 _Title; - set => SetProperty(ref _Title, value); - } - - private string _Message = ""; - public string Message - { - get => _Message; - set => SetProperty(ref _Message, value); - } - - private string _Icon= $"pack://siteoforigin:,,,/Resources/Images/info.png"; - public string Icon - { - get => _Icon; - set => SetProperty(ref _Icon, value); - } - - private bool _ShowYes; - public bool ShowYes - { - get => _ShowYes; - set => SetProperty(ref _ShowYes, value); - } - - private bool _ShowNo; - public bool ShowNo - { - get => _ShowNo; - set => SetProperty(ref _ShowNo, value); - } - - private bool _ShowOk; - public bool ShowOk - { - get => _ShowOk; - set => SetProperty(ref _ShowOk, value); - } - - private bool _ShowCancel; - public bool ShowCancel - { - get => _ShowCancel; - set => SetProperty(ref _ShowCancel, value); - } - - #endregion - - #region 命令 - public ICommand YesCommand { get; set; } - public ICommand NoCommand { get; set; } - public ICommand OkCommand { get; set; } - public ICommand CancelCommand { get; set; } - #endregion - - public DialogCloseListener RequestClose { get; set; } - - public MessageBoxViewModel(IContainerProvider containerProvider):base(containerProvider) - { - YesCommand = new DelegateCommand(OnYes); - NoCommand = new DelegateCommand(OnNo); - OkCommand = new DelegateCommand(OnOk); - CancelCommand = new DelegateCommand(OnCancel); - } - - private void CloseDialog(ButtonResult result) - { - var parameters = new DialogParameters(); - RequestClose.Invoke(new DialogResult(result)); - } - - private void OnYes() => CloseDialog(ButtonResult.Yes); - private void OnNo() => CloseDialog(ButtonResult.No); - private void OnOk() => CloseDialog(ButtonResult.OK); - private void OnCancel() => CloseDialog(ButtonResult.Cancel); - - #region Prism Dialog 规范 - public bool CanCloseDialog() => true; - - public override void OnDialogClosed() - { - _eventAggregator.GetEvent().Publish(false); - } - - public override void OnDialogOpened(IDialogParameters parameters) - { - _eventAggregator.GetEvent().Publish(true); - Title = parameters.GetValue("Title"); - Message = parameters.GetValue("Message"); - var iconKey = parameters.GetValue("Icon"); // info / error / warn - Icon = iconKey switch - { - "info" => $"pack://siteoforigin:,,,/Resources/Images/info.png", - "error" => $"pack://siteoforigin:,,,/Resources/Images/error.png", - "warn" => $"pack://siteoforigin:,,,/Resources/Images/warning.png", - _ => $"pack://siteoforigin:,,,/Resources/Images/info.png" // 默认 - }; - - - ShowYes = parameters.GetValue("ShowYes"); - ShowNo = parameters.GetValue("ShowNo"); - ShowOk = parameters.GetValue("ShowOk"); - ShowCancel = parameters.GetValue("ShowCancel"); - } - #endregion - } -} diff --git a/LOT/ViewModels/ShellViewModel.cs b/LOT/ViewModels/ShellViewModel.cs deleted file mode 100644 index 646d21c..0000000 --- a/LOT/ViewModels/ShellViewModel.cs +++ /dev/null @@ -1,109 +0,0 @@ -using Notifications.Wpf.Core; -using System.Windows; -using System.Windows.Input; -using UIShare.PubEvent; - -namespace LOT.ViewModels -{ - public class ShellViewModel : BindableBase - { - #region 属性 - private bool _IsLeftDrawerOpen; - - public bool IsLeftDrawerOpen - { - get => _IsLeftDrawerOpen; - set => SetProperty(ref _IsLeftDrawerOpen, value); - } - - #endregion - #region 命令 - public ICommand LeftDrawerOpenCommand { get; set; } - public ICommand MinimizeCommand { get; set; } - public ICommand MaximizeCommand { get; set; } - public ICommand CloseCommand { get; set; } - public ICommand NavigateCommand { get; set; } - public ICommand LoadCommand { get; set; } - - #endregion - - private IEventAggregator _eventAggregator; - private IRegionManager _regionManager; - private IContainerProvider _containerProvider; - private INotificationManager _notificationManager; - private IModuleManager _moduleManager; - public ShellViewModel( IContainerProvider containerProvider) - { - _containerProvider= containerProvider; - _eventAggregator = containerProvider.Resolve(); - _regionManager = containerProvider.Resolve(); - _notificationManager = containerProvider.Resolve(); - _moduleManager = containerProvider.Resolve(); - LeftDrawerOpenCommand = new DelegateCommand(LeftDrawerOpen); - MinimizeCommand = new DelegateCommand(MinimizeWindow); - MaximizeCommand = new DelegateCommand(MaximizeWindow); - CloseCommand = new DelegateCommand(CloseWindow); - NavigateCommand = new DelegateCommand(Navigate); - LoadCommand = new DelegateCommand(Load); - //订阅登录成功事件 - _eventAggregator.GetEvent().Subscribe(() => - { - Application.Current.MainWindow.Show(); - _regionManager.RequestNavigate("ShellViewManager", "MainView"); - }); - } - - #region 命令处理 - private void Load() - { - _notificationManager.ShowAsync(new NotificationContent { Title = "登录成功", Message = "", Type = NotificationType.Success }); - //默认导航到主界面 - Type moduleAType = typeof(MainModule.MainModule); - _moduleManager.LoadModule(moduleAType.Name); - } - private void Navigate(string content) - { - switch (content) - { - case "主界面": - _regionManager.RequestNavigate("ShellViewManager", "MainView"); - break; - - case "设置界面": - _regionManager.RequestNavigate("ShellViewManager", "SettingView"); - break; - - case "更新界面": - _regionManager.RequestNavigate("ShellViewManager", "UpdateInfoView"); - break; - - default: - break; - } - } - - private void LeftDrawerOpen() - { - IsLeftDrawerOpen = true; - } - private void MinimizeWindow(Window window) - { - if (window != null) - window.WindowState = WindowState.Minimized; - } - - private void MaximizeWindow(Window window) - { - if (window != null) - { - window.WindowState = window.WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized; - } - } - - private void CloseWindow(Window window) - { - window?.Close(); - } - #endregion - } -} diff --git a/LOT/Views/Dialogs/MessageBoxView.xaml b/LOT/Views/Dialogs/MessageBoxView.xaml deleted file mode 100644 index 7b13b8e..0000000 --- a/LOT/Views/Dialogs/MessageBoxView.xaml +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/LoginModule/Views/LoginView.xaml.cs b/LoginModule/Views/LoginView.xaml.cs deleted file mode 100644 index 31db76b..0000000 --- a/LoginModule/Views/LoginView.xaml.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace LoginModule.Views -{ - /// - /// LoginView.xaml 的交互逻辑 - /// - public partial class LoginView : UserControl - { - public LoginView() - { - InitializeComponent(); - } - } -} diff --git a/LoginModule/Views/RegisterView.xaml b/LoginModule/Views/RegisterView.xaml deleted file mode 100644 index 2708b9c..0000000 --- a/LoginModule/Views/RegisterView.xaml +++ /dev/null @@ -1,175 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/LoginModule/Views/RegisterView.xaml.cs b/LoginModule/Views/RegisterView.xaml.cs deleted file mode 100644 index f8d1138..0000000 --- a/LoginModule/Views/RegisterView.xaml.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace LoginModule.Views -{ - /// - /// RegisterView.xaml 的交互逻辑 - /// - public partial class RegisterView : UserControl - { - public RegisterView() - { - InitializeComponent(); - } - } -} diff --git a/MainModule/Events/ConnectionConfigEvent.cs b/MainModule/Events/ConnectionConfigEvent.cs deleted file mode 100644 index 8be73c8..0000000 --- a/MainModule/Events/ConnectionConfigEvent.cs +++ /dev/null @@ -1,35 +0,0 @@ -using Prism.Events; -using S7.Net; -using System.IO.Ports; - -namespace MainModule.Events -{ - public enum ProtocolType - { - S7, - ModbusTCP, - ModbusRTU, - TCP, - HTTP - } - - public class ConnectionConfigEvent : PubSubEvent - { - public class ConnectionConfigData - { - public ProtocolType Protocol { get; set; } - public string IpAddress { get; set; } = string.Empty; - public int Port { get; set; } - public string SerialPort { get; set; } = string.Empty; - public int BaudRate { get; set; } - public Parity Parity { get; set; } - public int DataBits { get; set; } - public StopBits StopBits { get; set; } - public CpuType CpuType { get; set; } - public short Rack { get; set; } - public short Slot { get; set; } - public int SendTimeout { get; set; } - public int ReceiveTimeout { get; set; } - } - } -} diff --git a/MainModule/MainModule.cs b/MainModule/MainModule.cs deleted file mode 100644 index 8e596cd..0000000 --- a/MainModule/MainModule.cs +++ /dev/null @@ -1,22 +0,0 @@ -using MainModule.ViewModels; -using MainModule.Views; -using Prism.Ioc; -using System.Reflection; - -namespace MainModule -{ - [Module(OnDemand=true)] - public class MainModule : IModule - { - public void OnInitialized(IContainerProvider containerProvider) - { - IRegionManager regionManager = containerProvider.Resolve(); - regionManager.RegisterViewWithRegion("ShellViewManager", typeof(MainView)); - } - - public void RegisterTypes(IContainerRegistry containerRegistry) - { - containerRegistry.RegisterForNavigation("MainView"); - } - } -} diff --git a/MainModule/MainModule.csproj b/MainModule/MainModule.csproj deleted file mode 100644 index d334cd2..0000000 --- a/MainModule/MainModule.csproj +++ /dev/null @@ -1,23 +0,0 @@ - - - - net8.0-windows - enable - true - enable - - - - - - - - - - - - Code - - - - diff --git a/MainModule/ViewModels/ConnectionConfigViewModel.cs b/MainModule/ViewModels/ConnectionConfigViewModel.cs deleted file mode 100644 index 59bd0bc..0000000 --- a/MainModule/ViewModels/ConnectionConfigViewModel.cs +++ /dev/null @@ -1,237 +0,0 @@ -using MainModule.Events; -using Prism.Commands; -using Prism.Mvvm; -using S7.Net; -using System.Collections.Generic; -using System.IO.Ports; -using System.Windows; - -namespace MainModule.ViewModels -{ - public class ConnectionConfigViewModel : BindableBase - { - #region 私有字段 - private Events.ProtocolType _selectedProtocol = Events.ProtocolType.S7; - private string _ipAddress = "127.0.0.1"; - private int _port = 502; - private string _serialPort = "COM1"; - private int _baudRate = 9600; - private Parity _parity = Parity.None; - private int _dataBits = 8; - private StopBits _stopBits = StopBits.One; - private CpuType _cpuType = CpuType.S71200; - private short _rack = 0; - private short _slot = 1; - private int _sendTimeout = 3000; - private int _receiveTimeout = 5000; - #endregion - - #region 公共属性 - public Events.ProtocolType SelectedProtocol - { - get => _selectedProtocol; - set - { - if (SetProperty(ref _selectedProtocol, value)) - { - RaisePropertyChanged(nameof(IsS7Protocol)); - RaisePropertyChanged(nameof(IsModbusTCPProtocol)); - RaisePropertyChanged(nameof(IsModbusRTUProtocol)); - RaisePropertyChanged(nameof(IsTCPProtocol)); - RaisePropertyChanged(nameof(IsHTTPProtocol)); - } - } - } - - public string IpAddress - { - get => _ipAddress; - set => SetProperty(ref _ipAddress, value); - } - - public int Port - { - get => _port; - set => SetProperty(ref _port, value); - } - - public string SerialPort - { - get => _serialPort; - set => SetProperty(ref _serialPort, value); - } - - public int BaudRate - { - get => _baudRate; - set => SetProperty(ref _baudRate, value); - } - - public Parity Parity - { - get => _parity; - set => SetProperty(ref _parity, value); - } - - public int DataBits - { - get => _dataBits; - set => SetProperty(ref _dataBits, value); - } - - public StopBits StopBits - { - get => _stopBits; - set => SetProperty(ref _stopBits, value); - } - - public CpuType CpuType - { - get => _cpuType; - set => SetProperty(ref _cpuType, value); - } - - public short Rack - { - get => _rack; - set => SetProperty(ref _rack, value); - } - - public short Slot - { - get => _slot; - set => SetProperty(ref _slot, value); - } - - public int SendTimeout - { - get => _sendTimeout; - set => SetProperty(ref _sendTimeout, value); - } - - public int ReceiveTimeout - { - get => _receiveTimeout; - set => SetProperty(ref _receiveTimeout, value); - } - #endregion - - #region 协议类型判断属性 - public bool IsS7Protocol => SelectedProtocol == Events.ProtocolType.S7; - public bool IsModbusTCPProtocol => SelectedProtocol == Events.ProtocolType.ModbusTCP; - public bool IsModbusRTUProtocol => SelectedProtocol == Events.ProtocolType.ModbusRTU; - public bool IsTCPProtocol => SelectedProtocol == Events.ProtocolType.TCP; - public bool IsHTTPProtocol => SelectedProtocol == Events.ProtocolType.HTTP; - #endregion - - #region 下拉列表数据源 - public List CpuTypes { get; } = new List - { - CpuType.S71200, - CpuType.S71500, - CpuType.S7200, - CpuType.S7300, - CpuType.S7400, - CpuType.S7200Smart - }; - - public List BaudRates { get; } = new List - { - 9600, - 19200, - 38400, - 57600, - 115200 - }; - - public List DataBitsList { get; } = new List { 7, 8 }; - - public List ParityList { get; } = new List - { - Parity.None, - Parity.Odd, - Parity.Even, - Parity.Mark, - Parity.Space - }; - - public List StopBitsList { get; } = new List - { - StopBits.None, - StopBits.One, - StopBits.OnePointFive, - StopBits.Two - }; - - public List SerialPorts { get; } = new List - { - "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8" - }; - #endregion - - #region 命令 - public DelegateCommand ConfirmCommand { get; } - public DelegateCommand CancelCommand { get; } - public DelegateCommand SelectS7Command { get; } - public DelegateCommand SelectModbusTCPCommand { get; } - public DelegateCommand SelectModbusRTUCommand { get; } - public DelegateCommand SelectTCPCommand { get; } - public DelegateCommand SelectHTTPCommand { get; } - #endregion - - #region 配置数据(供外部获取) - public ConnectionConfigEvent.ConnectionConfigData ConnectionConfigData { get; private set; } - #endregion - - public ConnectionConfigViewModel() - { - ConfirmCommand = new DelegateCommand(ExecuteConfirm); - CancelCommand = new DelegateCommand(ExecuteCancel); - SelectS7Command = new DelegateCommand(() => SelectedProtocol = Events.ProtocolType.S7); - SelectModbusTCPCommand = new DelegateCommand(() => SelectedProtocol = Events.ProtocolType.ModbusTCP); - SelectModbusRTUCommand = new DelegateCommand(() => SelectedProtocol = Events.ProtocolType.ModbusRTU); - SelectTCPCommand = new DelegateCommand(() => SelectedProtocol = Events.ProtocolType.TCP); - SelectHTTPCommand = new DelegateCommand(() => SelectedProtocol = Events.ProtocolType.HTTP); - } - - #region 命令执行 - private void ExecuteConfirm() - { - ConnectionConfigData = new ConnectionConfigEvent.ConnectionConfigData - { - Protocol = SelectedProtocol, - IpAddress = IpAddress, - Port = Port, - SerialPort = SerialPort, - BaudRate = BaudRate, - Parity = Parity, - DataBits = DataBits, - StopBits = StopBits, - CpuType = CpuType, - Rack = Rack, - Slot = Slot, - SendTimeout = SendTimeout, - ReceiveTimeout = ReceiveTimeout - }; - - var window = Application.Current.Windows.OfType().FirstOrDefault(); - if (window != null) - { - window.DialogResult = true; - window.Close(); - } - } - - private void ExecuteCancel() - { - ConnectionConfigData = null; - var window = Application.Current.Windows.OfType().FirstOrDefault(); - if (window != null) - { - window.DialogResult = false; - window.Close(); - } - } - #endregion - } -} diff --git a/MainModule/ViewModels/MainViewModel.cs b/MainModule/ViewModels/MainViewModel.cs deleted file mode 100644 index 9d41537..0000000 --- a/MainModule/ViewModels/MainViewModel.cs +++ /dev/null @@ -1,846 +0,0 @@ -using DeviceCommand.Base; -using DeviceCommand.Devices; -using MainModule.Events; -using MainModule.Views; -using Model.Entity; -using Prism.Commands; -using Prism.Events; -using Prism.Ioc; -using Prism.Navigation; -using System.Collections.ObjectModel; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Threading; -using UIShare.ViewModelBase; - -namespace MainModule.ViewModels -{ - public class MainViewModel : NavigateViewModelBase - { - private readonly THC1100 _thc1100 = new(); - private readonly UMC1300 _umc1300; - private UMC1000Rtu? _umc1000Rtu; - public ObservableCollection Chambers { get; } = new(); - private IContainerProvider _containerProvider; - private CancellationTokenSource _refreshCts; - private DispatcherTimer _refreshTimer; - private bool _isInitialized = false; - - #region 按钮文本和连接状态 - private string _connectButtonText = "连接设备"; - public string ConnectButtonText - { - get => _connectButtonText; - set => SetProperty(ref _connectButtonText, value); - } - - private bool _isConnected = false; - public bool IsConnected - { - get => _isConnected; - set - { - if (SetProperty(ref _isConnected, value)) - { - ConnectButtonText = value ? "断开连接" : "连接设备"; - } - } - } - #endregion - - #region 命令定义 - public DelegateCommand ConnectCommand { get; } - public DelegateCommand DisconnectCommand { get; } - public DelegateCommand RefreshCommand { get; } - public DelegateCommand ConfigCommand { get; } - public DelegateCommand ConnectDeviceCommand { get; } - #endregion - - #region 配置信息 - private Events.ProtocolType _selectedProtocol = Events.ProtocolType.S7; - public Events.ProtocolType SelectedProtocol - { - get => _selectedProtocol; - set => SetProperty(ref _selectedProtocol, value); - } - - private string _configIpAddress = "127.0.0.1"; - public string ConfigIpAddress - { - get => _configIpAddress; - set => SetProperty(ref _configIpAddress, value); - } - - private int _configPort = 102; - public int ConfigPort - { - get => _configPort; - set => SetProperty(ref _configPort, value); - } - - private S7.Net.CpuType _configCpuType = S7.Net.CpuType.S71200; - public S7.Net.CpuType ConfigCpuType - { - get => _configCpuType; - set => SetProperty(ref _configCpuType, value); - } - - private short _configRack = 0; - public short ConfigRack - { - get => _configRack; - set => SetProperty(ref _configRack, value); - } - - private short _configSlot = 1; - public short ConfigSlot - { - get => _configSlot; - set => SetProperty(ref _configSlot, value); - } - - private string _configSerialPort = "COM1"; - public string ConfigSerialPort - { - get => _configSerialPort; - set => SetProperty(ref _configSerialPort, value); - } - - private int _configBaudRate = 9600; - public int ConfigBaudRate - { - get => _configBaudRate; - set => SetProperty(ref _configBaudRate, value); - } - - private int _configDataBits = 8; - public int ConfigDataBits - { - get => _configDataBits; - set => SetProperty(ref _configDataBits, value); - } - - private byte _configSlaveId = 1; - public byte ConfigSlaveId - { - get => _configSlaveId; - set => SetProperty(ref _configSlaveId, value); - } - - private int _configSendTimeout = 3000; - public int ConfigSendTimeout - { - get => _configSendTimeout; - set => SetProperty(ref _configSendTimeout, value); - } - - private int _configReceiveTimeout = 5000; - public int ConfigReceiveTimeout - { - get => _configReceiveTimeout; - set => SetProperty(ref _configReceiveTimeout, value); - } - #endregion - - public MainViewModel(IContainerProvider containerProvider) : base(containerProvider) - { - _containerProvider = containerProvider; - - // 初始化UMC1300设备(默认从站地址1) - _umc1300 = new UMC1300(1, "127.0.0.1", 502); - - // 初始化命令 - ConnectCommand = new DelegateCommand(async () => await ExecuteConnectAsync()); - DisconnectCommand = new DelegateCommand(ExecuteDisconnect); - RefreshCommand = new DelegateCommand(async () => await RefreshDeviceDataAsync()); - ConfigCommand = new DelegateCommand(() => ShowConfigDialogAsync()); - ConnectDeviceCommand = new DelegateCommand(async (item) => await ExecuteConnectDeviceAsync(item)); - } - - /// - /// 当视图被导航到时执行初始化(Prism导航机制) - /// - public override async void OnNavigatedTo(NavigationContext navigationContext) - { - base.OnNavigatedTo(navigationContext); - - // 避免重复初始化 - if (_isInitialized) - return; - _isInitialized = true; - - await InitializeAsync(); - } - - /// - /// 异步初始化设备连接和数据 - /// - private async Task InitializeAsync() - { - try - { - // 先添加所有卡片(显示初始状态) - Application.Current.Dispatcher.Invoke(() => - { - Chambers.Clear(); - Chambers.Add(new ChamberMonitorItem - { - Id = 1, - Name = "环境箱 01", - ProtocolType = "Modbus TCP", - IsConnected = false, - Temperature = 0.0, - Humidity = 0.0 - }); - - Chambers.Add(new ChamberMonitorItem - { - Id = 2, - Name = "环境箱 02", - ProtocolType = "Modbus RTU", - IsConnected = false, - Temperature = 0.0, - Humidity = 0.0 - }); - - Chambers.Add(new ChamberMonitorItem - { - Id = 3, - Name = "环境箱 03", - ProtocolType = "S7", - IsConnected = false, - Temperature = 0.0, - Humidity = 0.0 - }); - - Chambers.Add(new ChamberMonitorItem - { - Id = 4, - Name = "环境箱 04", - ProtocolType = "HTTP", - IsConnected = false, - Temperature = 0.0, - Humidity = 0.0 - }); - }); - - System.Diagnostics.Debug.WriteLine("设备卡片初始化完成"); - } - catch (System.Exception ex) - { - System.Diagnostics.Debug.WriteLine($"初始化异常: {ex.Message}"); - } - } - - #region 配置对话框 - /// - /// 显示配置连接对话框 - /// - private void ShowConfigDialogAsync() - { - try - { - // 手动创建 ViewModel - var viewModel = new ConnectionConfigViewModel(); - - // 设置初始值 - viewModel.SelectedProtocol = SelectedProtocol; - viewModel.IpAddress = ConfigIpAddress; - viewModel.Port = ConfigPort; - viewModel.CpuType = ConfigCpuType; - viewModel.Rack = ConfigRack; - viewModel.Slot = ConfigSlot; - viewModel.SerialPort = ConfigSerialPort; - viewModel.BaudRate = ConfigBaudRate; - viewModel.SendTimeout = ConfigSendTimeout; - viewModel.ReceiveTimeout = ConfigReceiveTimeout; - - // 创建窗口 - var configWindow = new ConnectionConfigView(viewModel); - - // 设置父窗口 - configWindow.Owner = Application.Current.MainWindow; - - // 显示模态对话框 - bool? result = configWindow.ShowDialog(); - - // 如果用户点击确定,获取配置数据 - if (result == true && viewModel.ConnectionConfigData != null) - { - // 直接更新配置参数 - SelectedProtocol = viewModel.ConnectionConfigData.Protocol; - ConfigIpAddress = viewModel.ConnectionConfigData.IpAddress; - ConfigPort = viewModel.ConnectionConfigData.Port; - ConfigCpuType = viewModel.ConnectionConfigData.CpuType; - ConfigRack = viewModel.ConnectionConfigData.Rack; - ConfigSlot = viewModel.ConnectionConfigData.Slot; - ConfigSerialPort = viewModel.ConnectionConfigData.SerialPort; - ConfigBaudRate = viewModel.ConnectionConfigData.BaudRate; - ConfigSendTimeout = viewModel.ConnectionConfigData.SendTimeout; - ConfigReceiveTimeout = viewModel.ConnectionConfigData.ReceiveTimeout; - - System.Diagnostics.Debug.WriteLine($"配置更新成功: 协议={SelectedProtocol}, IP={ConfigIpAddress}, 端口={ConfigPort}"); - } - } - catch (System.Exception ex) - { - System.Diagnostics.Debug.WriteLine($"打开配置对话框异常: {ex.Message}"); - } - } - - /// - /// 配置更新事件处理 - /// - private void OnConfigUpdated(ConnectionConfigEvent.ConnectionConfigData config) - { - SelectedProtocol = config.Protocol; - ConfigIpAddress = config.IpAddress; - ConfigPort = config.Port; - ConfigCpuType = config.CpuType; - ConfigRack = config.Rack; - ConfigSlot = config.Slot; - ConfigSerialPort = config.SerialPort; - ConfigBaudRate = config.BaudRate; - ConfigSendTimeout = config.SendTimeout; - ConfigReceiveTimeout = config.ReceiveTimeout; - - System.Diagnostics.Debug.WriteLine($"配置更新: 协议={SelectedProtocol}, IP={ConfigIpAddress}, 端口={ConfigPort}"); - } - #endregion - - #region 连接命令实现 - /// - /// 执行连接/断开切换命令 - /// - private async Task ExecuteConnectAsync() - { - if (IsConnected) - { - // 如果已连接,则断开 - ExecuteDisconnect(); - } - else - { - // 如果未连接,则连接 - await ConnectToDeviceAsync(); - } - } - - /// - /// 连接到THC设备 - /// - private async Task ConnectToDeviceAsync() - { - try - { - System.Diagnostics.Debug.WriteLine("正在连接THC设备..."); - - // 使用配置对话框中设置的参数配置设备 - _thc1100.ConfigureDevice( - ipAddress: ConfigIpAddress, - cpuType: ConfigCpuType, - rack: ConfigRack, - slot: ConfigSlot - ); - System.Diagnostics.Debug.WriteLine($"配置参数: 协议={SelectedProtocol}, IP={_thc1100.IPAddress}, CPU={_thc1100.CpuType}, Rack={_thc1100.Rack}, Slot={_thc1100.Slot}"); - - // 连接THC设备 - bool connected = await _thc1100.ConnectAsync(); - - if (connected) - { - IsConnected = true; - System.Windows.MessageBox.Show("THC设备连接成功", "连接成功", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Information); - - // 更新环境箱03的连接状态 - var chamber3 = GetChamberById(3); - if (chamber3 != null) - { - chamber3.IsConnected = true; - } - - // 读取初始数据 - await RefreshDeviceDataAsync(); - - // 启动定时刷新(每1秒) - StartPeriodicRefresh(); - } - else - { - System.Diagnostics.Debug.WriteLine("THC设备连接失败"); - MessageBox.Show("设备连接失败,请检查网络和设备状态!", "连接失败", - MessageBoxButton.OK, MessageBoxImage.Warning); - } - } - catch (System.Exception ex) - { - System.Diagnostics.Debug.WriteLine($"连接异常: {ex.Message}"); - MessageBox.Show($"连接异常: {ex.Message}", "错误", - MessageBoxButton.OK, MessageBoxImage.Error); - } - } - - /// - /// 断开THC设备连接 - /// - private void ExecuteDisconnect() - { - try - { - // 停止定时器 - _refreshCts?.Cancel(); - _refreshTimer?.Stop(); - - // 关闭设备连接 - _thc1100.Close(); - - // 更新连接状态 - IsConnected = false; - - // 更新环境箱03的连接状态 - var chamber3 = GetChamberById(3); - if (chamber3 != null) - { - chamber3.IsConnected = false; - } - - System.Diagnostics.Debug.WriteLine("THC设备已断开连接"); - } - catch (System.Exception ex) - { - System.Diagnostics.Debug.WriteLine($"断开连接异常: {ex.Message}"); - } - } - #endregion - - #region 定时刷新 - /// - /// 启动定时刷新 - /// - private void StartPeriodicRefresh() - { - _refreshCts?.Cancel(); - _refreshCts = new CancellationTokenSource(); - - _refreshTimer?.Stop(); - _refreshTimer = new DispatcherTimer - { - Interval = TimeSpan.FromSeconds(1) - }; - - _refreshTimer.Tick += async (s, e) => - { - try - { - System.Diagnostics.Debug.WriteLine($"[定时刷新] Tick触发,当前时间: {DateTime.Now:HH:mm:ss.fff}"); - System.Diagnostics.Debug.WriteLine($"[定时刷新] THC1100.IsConnected = {_thc1100.IsConnected}"); - - // 检查THC1100连接状态 - if (_thc1100.IsConnected) - { - var chamber3 = GetChamberById(3); - System.Diagnostics.Debug.WriteLine($"[定时刷新] chamber3 = {chamber3}, IsConnected = {chamber3?.IsConnected}"); - - if (chamber3 != null) - { - System.Diagnostics.Debug.WriteLine("[定时刷新] 开始读取温湿度数据..."); - try - { - var temp = await _thc1100.GetRealTimeTemperatureSetPointAsync(); - var humidity = await _thc1100.GetRealTimeHumidityMeasuredValueAsync(); - - System.Diagnostics.Debug.WriteLine($"[定时刷新] 读取完成 - 温度(DB53.DBD280): {temp}, 湿度(DB53.DBD1092): {humidity}"); - - Application.Current.Dispatcher.Invoke(() => - { - chamber3.Temperature = temp; - chamber3.Humidity = humidity; - System.Diagnostics.Debug.WriteLine($"[定时刷新] UI已更新 - Temperature={chamber3.Temperature}, Humidity={chamber3.Humidity}"); - }); - } - catch (Exception ex) - { - System.Diagnostics.Debug.WriteLine($"[定时刷新] 读取温湿度数据异常: {ex.Message}"); - } - } - } - else - { - System.Diagnostics.Debug.WriteLine("[定时刷新] THC1100未连接,跳过数据读取"); - } - - // 检查UMC1300连接状态 → 环境箱01 (Modbus TCP) - if (_umc1300.IsConnected) - { - var chamber1 = GetChamberById(1); - if (chamber1 != null) - { - try - { - var temp = await _umc1300.ReadTemperaturePVAsync(); - var humidity = await _umc1300.ReadHumidityPVAsync(); - - Application.Current.Dispatcher.Invoke(() => - { - chamber1.Temperature = temp; - chamber1.Humidity = humidity; - }); - } - catch (Exception ex) - { - System.Diagnostics.Debug.WriteLine($"[定时刷新] 读取UMC1300数据异常: {ex.Message}"); - } - } - } - - // 检查UMC1000Rtu连接状态 → 环境箱02 (Modbus RTU) - if (_umc1000Rtu != null && _umc1000Rtu.IsConnected) - { - var chamber2 = GetChamberById(2); - if (chamber2 != null) - { - try - { - var temp = await _umc1000Rtu.ReadTemperatureAsync(); - var humidity = await _umc1000Rtu.ReadHumidityAsync(); - - Application.Current.Dispatcher.Invoke(() => - { - chamber2.Temperature = temp; - chamber2.Humidity = humidity; - }); - } - catch (Exception ex) - { - System.Diagnostics.Debug.WriteLine($"[定时刷新] 读取UMC1000Rtu数据异常: {ex.Message}"); - } - } - } - } - catch (Exception ex) - { - System.Diagnostics.Debug.WriteLine($"[定时刷新] 定时器异常: {ex.Message}"); - } - }; - - _refreshTimer.Start(); - } - - /// - /// 停止定时刷新 - /// - private void StopPeriodicRefresh() - { - _refreshCts?.Cancel(); - _refreshTimer?.Stop(); - } - #endregion - - #region 数据刷新 - /// - /// 刷新设备数据 - /// - private async Task RefreshDeviceDataAsync() - { - try - { - // 如果未连接,不刷新数据 - if (!_thc1100.IsConnected) - return; - - var chamber3 = GetChamberById(3); - if (chamber3 == null) return; - - // 读取温湿度数据(使用用户指定的寄存器地址) - // 温度: DB53.DBD280, 湿度: DB53.DBD1092 - var temp = await _thc1100.GetRealTimeTemperatureSetPointAsync(); - var humidity = await _thc1100.GetRealTimeHumidityMeasuredValueAsync(); - - System.Diagnostics.Debug.WriteLine($"[初始刷新] 环境箱3 - 温度(DB53.DBD280): {temp}, 湿度(DB53.DBD1092): {humidity}"); - - // 更新UI(在UI线程执行) - Application.Current.Dispatcher.Invoke(() => - { - chamber3.Temperature = temp; - chamber3.Humidity = humidity; - }); - } - catch (System.Exception ex) - { - System.Diagnostics.Debug.WriteLine($"刷新数据异常: {ex.Message}"); - } - } - #endregion - - #region 辅助方法 - /// - /// 根据ID获取卡片 - /// - private ChamberMonitorItem GetChamberById(int id) - { - foreach (var chamber in Chambers) - { - if (chamber.Id == id) - return chamber; - } - return null; - } - - /// - /// 根据设备类型连接单个设备 - /// - private async Task ExecuteConnectDeviceAsync(ChamberMonitorItem item) - { - if (item == null) return; - - try - { - if (item.IsConnected) - { - // 断开连接 - System.Diagnostics.Debug.WriteLine($"[连接] 正在断开设备 {item.Name}"); - - // 根据设备自己的协议类型调用对应设备的Close方法 - switch (item.ProtocolType) - { - case "S7": - _thc1100.Close(); - break; - case "Modbus TCP": - _umc1300.Close(); - break; - case "Modbus RTU": - _umc1000Rtu?.Close(); - break; - } - - // 停止数据刷新 - StopPeriodicRefresh(); - - item.IsConnected = false; - System.Diagnostics.Debug.WriteLine($"[连接] 设备 {item.Name} 已断开连接"); - } - else - { - // 输出当前配置参数 - System.Diagnostics.Debug.WriteLine($"[连接] ========== 开始连接设备 {item.Name} =========="); - System.Diagnostics.Debug.WriteLine($"[连接] 当前协议类型: {SelectedProtocol}"); - System.Diagnostics.Debug.WriteLine($"[连接] IP地址: {ConfigIpAddress}"); - System.Diagnostics.Debug.WriteLine($"[连接] 端口: {ConfigPort}"); - System.Diagnostics.Debug.WriteLine($"[连接] CPU类型: {ConfigCpuType}"); - System.Diagnostics.Debug.WriteLine($"[连接] Rack: {ConfigRack}, Slot: {ConfigSlot}"); - System.Diagnostics.Debug.WriteLine($"[连接] 串口: {ConfigSerialPort}, 波特率: {ConfigBaudRate}"); - System.Diagnostics.Debug.WriteLine($"[连接] 发送超时: {ConfigSendTimeout}ms, 接收超时: {ConfigReceiveTimeout}ms"); - - // 根据设备自己的协议类型连接设备 - bool connected = false; - System.Diagnostics.Debug.WriteLine($"[连接] 设备协议类型: {item.ProtocolType}"); - - switch (item.ProtocolType) - { - case "S7": - // S7协议连接 - System.Diagnostics.Debug.WriteLine("[连接] 使用设备配置的S7协议"); - connected = await ConnectS7DeviceAsync(item); - break; - case "Modbus TCP": - // Modbus TCP连接 - System.Diagnostics.Debug.WriteLine("[连接] 使用设备配置的Modbus TCP协议"); - connected = await ConnectModbusTcpDeviceAsync(item); - break; - case "Modbus RTU": - // Modbus RTU连接 → UMC1000Rtu 温湿度 - System.Diagnostics.Debug.WriteLine("[连接] 使用设备配置的Modbus RTU协议"); - connected = await ConnectUMC1000RtuDeviceAsync(item); - break; - case "HTTP": - // HTTP连接 - System.Diagnostics.Debug.WriteLine("[连接] 使用设备配置的HTTP协议"); - connected = await ConnectHttpDeviceAsync(item); - break; - default: - System.Diagnostics.Debug.WriteLine($"[连接] 未知协议类型: {item.ProtocolType}"); - break; - } - - item.IsConnected = connected; - System.Diagnostics.Debug.WriteLine($"[连接] 设备 {item.Name} 连接结果: {(connected ? "成功" : "失败")}"); - System.Diagnostics.Debug.WriteLine($"[连接] ========== 连接尝试结束 =========="); - } - } - catch (System.Exception ex) - { - System.Diagnostics.Debug.WriteLine($"[连接] 设备 {item.Name} 连接异常: {ex.Message}"); - System.Diagnostics.Debug.WriteLine($"[连接] 异常堆栈: {ex.StackTrace}"); - item.IsConnected = false; - } - } - - /// - /// S7协议设备连接 - /// - private async Task ConnectS7DeviceAsync(ChamberMonitorItem item) - { - try - { - System.Diagnostics.Debug.WriteLine($"[ConnectS7DeviceAsync] 开始配置设备: IP={ConfigIpAddress}, CPU={ConfigCpuType}, Rack={ConfigRack}, Slot={ConfigSlot}"); - - _thc1100.ConfigureDevice(ConfigIpAddress, ConfigCpuType, ConfigRack, ConfigSlot); - bool result = await _thc1100.ConnectAsync(); - - System.Diagnostics.Debug.WriteLine($"[ConnectS7DeviceAsync] 连接结果: {result}, IsConnected属性值: {_thc1100.IsConnected}"); - - if (result) - { - System.Diagnostics.Debug.WriteLine("[ConnectS7DeviceAsync] 连接成功,启动定时刷新"); - StartPeriodicRefresh(); - } - - return result; - } - catch (Exception ex) - { - System.Diagnostics.Debug.WriteLine($"[ConnectS7DeviceAsync] 异常: {ex.Message}, 堆栈: {ex.StackTrace}"); - return false; - } - } - - /// - /// UMC1000Rtu 温湿度设备连接(Modbus RTU) - /// - private async Task ConnectUMC1000RtuDeviceAsync(ChamberMonitorItem item) - { - try - { - _umc1000Rtu = new UMC1000Rtu( - slaveId: ConfigSlaveId, - portName: ConfigSerialPort, - baudRate: ConfigBaudRate, - dataBits: ConfigDataBits, - stopBits: System.IO.Ports.StopBits.One, - parity: System.IO.Ports.Parity.None, - readTimeout: ConfigReceiveTimeout, - writeTimeout: ConfigSendTimeout); - - bool result = await _umc1000Rtu.ConnectAsync(); - - if (result) - { - StartPeriodicRefresh(); - } - - System.Diagnostics.Debug.WriteLine($"UMC1000Rtu Modbus RTU连接: {ConfigSerialPort}, 波特率:{ConfigBaudRate}, 从站:{ConfigSlaveId}, 结果: {result}"); - return result; - } - catch (System.Exception ex) - { - System.Diagnostics.Debug.WriteLine($"UMC1000Rtu连接异常: {ex.Message}"); - return false; - } - } - - /// - /// Modbus TCP设备连接(UMC1300) - /// - private async Task ConnectModbusTcpDeviceAsync(ChamberMonitorItem item) - { - try - { - _umc1300.ConfigureDevice(ConfigIpAddress, ConfigPort, ConfigSendTimeout, ConfigReceiveTimeout); - bool result = await _umc1300.ConnectAsync(); - - if (result) - { - StartPeriodicRefresh(); - } - - System.Diagnostics.Debug.WriteLine($"UMC1300 Modbus TCP连接: {ConfigIpAddress}:{ConfigPort}, 结果: {result}"); - return result; - } - catch (System.Exception ex) - { - System.Diagnostics.Debug.WriteLine($"UMC1300连接异常: {ex.Message}"); - return false; - } - } - - /// - /// HTTP设备连接 - /// - private async Task ConnectHttpDeviceAsync(ChamberMonitorItem item) - { - // 实现HTTP连接逻辑 - System.Diagnostics.Debug.WriteLine($"HTTP连接: {ConfigIpAddress}:{ConfigPort}"); - await Task.Delay(500); - return true; - } - #endregion - - #region 生命周期管理 - /// - /// 导航离开时清理资源 - /// - public override void OnNavigatedFrom(NavigationContext navigationContext) - { - base.OnNavigatedFrom(navigationContext); - - ExecuteDisconnect(); - _isInitialized = false; - } - #endregion - } - - /// - /// 环境箱 UI 状态及温湿度数据绑定模型 - /// - public class ChamberMonitorItem : BindableBase - { - private double _temperature; - private double _humidity; - private bool _isConnected; - - public int Id { get; set; } - public string Name { get; set; } = string.Empty; - public string ProtocolType { get; set; } = string.Empty; - - /// - /// 温度(支持通知刷新) - /// - public double Temperature - { - get => _temperature; - set => SetProperty(ref _temperature, value); - } - - /// - /// 湿度(支持通知刷新) - /// - public double Humidity - { - get => _humidity; - set => SetProperty(ref _humidity, value); - } - - /// - /// 连接状态:True-已连接(绿灯),False-断开(红灯) - /// - public bool IsConnected - { - get => _isConnected; - set - { - if (SetProperty(ref _isConnected, value)) - { - RaisePropertyChanged(nameof(ConnectButtonText)); - } - } - } - - /// - /// 连接按钮文本 - /// - public string ConnectButtonText => IsConnected ? "断开连接" : "连接设备"; - } -} diff --git a/MainModule/Views/ConnectionConfigView.xaml b/MainModule/Views/ConnectionConfigView.xaml deleted file mode 100644 index f3e896c..0000000 --- a/MainModule/Views/ConnectionConfigView.xaml +++ /dev/null @@ -1,285 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/MainModule/Views/MainView.xaml.cs b/MainModule/Views/MainView.xaml.cs deleted file mode 100644 index a2a7212..0000000 --- a/MainModule/Views/MainView.xaml.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace MainModule.Views -{ - /// - /// MainView.xaml 的交互逻辑 - /// - public partial class MainView : UserControl - { - public MainView() - { - InitializeComponent(); - } - - - } -} \ No newline at end of file diff --git a/SettingModule/SettingModule.cs b/SettingModule/SettingModule.cs deleted file mode 100644 index 56f2440..0000000 --- a/SettingModule/SettingModule.cs +++ /dev/null @@ -1,19 +0,0 @@ -using SettingModule.Views; -using System.Reflection; - -namespace SettingModule -{ - public class SettingModule : IModule - { - public void OnInitialized(IContainerProvider containerProvider) - { - IRegionManager regionManager = containerProvider.Resolve(); - regionManager.RegisterViewWithRegion("ShellViewManager", typeof(SettingView)); - } - - public void RegisterTypes(IContainerRegistry containerRegistry) - { - containerRegistry.RegisterForNavigation("SettingView"); - } - } -} diff --git a/SettingModule/SettingModule.csproj b/SettingModule/SettingModule.csproj deleted file mode 100644 index 8d75460..0000000 --- a/SettingModule/SettingModule.csproj +++ /dev/null @@ -1,23 +0,0 @@ - - - - net8.0-windows - enable - true - enable - - - - - - - - - Code - - - Code - - - - diff --git a/SettingModule/ViewModels/SettingViewModel.cs b/SettingModule/ViewModels/SettingViewModel.cs deleted file mode 100644 index 4a152e0..0000000 --- a/SettingModule/ViewModels/SettingViewModel.cs +++ /dev/null @@ -1,28 +0,0 @@ -using UIShare.ViewModelBase; - -namespace SettingModule.ViewModels -{ - public class SettingViewModel : NavigateViewModelBase - { - #region 属性 - - - #endregion - #region 命令 - - - - #endregion - public SettingViewModel(IContainerProvider containerProvider) : base(containerProvider) - { - - - } - #region 命令处理 - - - - #endregion - - } -} diff --git a/SettingModule/Views/SettingView.xaml b/SettingModule/Views/SettingView.xaml deleted file mode 100644 index b553d29..0000000 --- a/SettingModule/Views/SettingView.xaml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - diff --git a/SettingModule/Views/SettingView.xaml.cs b/SettingModule/Views/SettingView.xaml.cs deleted file mode 100644 index 41c770b..0000000 --- a/SettingModule/Views/SettingView.xaml.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace SettingModule.Views -{ - /// - /// SettingView.xaml 的交互逻辑 - /// - public partial class SettingView : UserControl - { - public SettingView() - { - InitializeComponent(); - } - } -} diff --git a/UIShare/Converters/BooleanToVisibilityConverter.cs b/UIShare/Converters/BooleanToVisibilityConverter.cs deleted file mode 100644 index db57ae8..0000000 --- a/UIShare/Converters/BooleanToVisibilityConverter.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Data; - -namespace UIShare.Converters -{ - public class BooleanToVisibilityConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - bool input = value is bool b && b; - bool invert = parameter?.ToString()?.ToLower() == "invert"; - - if (invert) - input = !input; - - return input ? Visibility.Visible : Visibility.Collapsed; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - bool output = value is Visibility v && v == Visibility.Visible; - bool invert = parameter?.ToString()?.ToLower() == "invert"; - - if (invert) - output = !output; - - return output; - } - } -} diff --git a/UIShare/Helpers/PasswordBoxHelper.cs b/UIShare/Helpers/PasswordBoxHelper.cs deleted file mode 100644 index e5eadd4..0000000 --- a/UIShare/Helpers/PasswordBoxHelper.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; - -namespace UIShare.Helpers -{ - public static class PasswordBoxHelper - { - public static readonly DependencyProperty PasswordProperty = - DependencyProperty.RegisterAttached( - "Password", - typeof(string), - typeof(PasswordBoxHelper), - new FrameworkPropertyMetadata( - string.Empty, - FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, - OnPasswordPropertyChanged)); - - public static void SetPassword(DependencyObject d, string value) - => d.SetValue(PasswordProperty, value); - - public static string GetPassword(DependencyObject d) - => (string)d.GetValue(PasswordProperty); - - private static void OnPasswordPropertyChanged( - DependencyObject d, - DependencyPropertyChangedEventArgs e) - { - if (d is PasswordBox pb) - { - pb.PasswordChanged -= PasswordChanged; - if (pb.Password != (string)e.NewValue) - { - pb.Password = (string)e.NewValue; - } - pb.PasswordChanged += PasswordChanged; - } - } - - private static void PasswordChanged(object sender, RoutedEventArgs e) - { - if (sender is PasswordBox pb) - { - SetPassword(pb, pb.Password); - } - } - } -} diff --git a/UIShare/PubEvent/LoginSuccessEvent.cs b/UIShare/PubEvent/LoginSuccessEvent.cs deleted file mode 100644 index 45201c8..0000000 --- a/UIShare/PubEvent/LoginSuccessEvent.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace UIShare.PubEvent -{ - public class LoginSuccessEvent:PubSubEvent - { - } -} diff --git a/UIShare/PubEvent/OverlayEvent.cs b/UIShare/PubEvent/OverlayEvent.cs deleted file mode 100644 index dd886db..0000000 --- a/UIShare/PubEvent/OverlayEvent.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace UIShare.PubEvent -{ - public class OverlayEvent : PubSubEvent - { - } -} diff --git a/UIShare/PubEvent/WaitingEvent.cs b/UIShare/PubEvent/WaitingEvent.cs deleted file mode 100644 index 1633c54..0000000 --- a/UIShare/PubEvent/WaitingEvent.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace UIShare.PubEvent -{ - public class WaitingEvent : PubSubEvent - { - } -} diff --git a/UIShare/Styles/CommonStyle.xaml b/UIShare/Styles/CommonStyle.xaml deleted file mode 100644 index e59a590..0000000 --- a/UIShare/Styles/CommonStyle.xaml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/UIShare/Styles/WindowStyle.xaml b/UIShare/Styles/WindowStyle.xaml deleted file mode 100644 index 393226b..0000000 --- a/UIShare/Styles/WindowStyle.xaml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - diff --git a/UIShare/UIShare.csproj b/UIShare/UIShare.csproj deleted file mode 100644 index 7ccaa94..0000000 --- a/UIShare/UIShare.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - net8.0-windows - enable - true - enable - - - - - - - - - - - - - diff --git a/UIShare/ViewModelBase/DialogViewModelBase.cs b/UIShare/ViewModelBase/DialogViewModelBase.cs deleted file mode 100644 index a6c15bd..0000000 --- a/UIShare/ViewModelBase/DialogViewModelBase.cs +++ /dev/null @@ -1,27 +0,0 @@ -using Notifications.Wpf.Core; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace UIShare.ViewModelBase -{ - public abstract class DialogViewModelBase : BindableBase,IDialogAware - { - public DialogCloseListener RequestClose { get; set; } - public IEventAggregator _eventAggregator; - private INotificationManager _notificationManager; - public DialogViewModelBase(IContainerProvider containerProvider) - { - _eventAggregator = containerProvider.Resolve(); - _notificationManager = containerProvider.Resolve(); - } - #region Dialog - - public virtual bool CanCloseDialog() => true; - public virtual void OnDialogClosed() { } - public virtual void OnDialogOpened(IDialogParameters parameters) { } - #endregion - } -} diff --git a/UIShare/ViewModelBase/NavigateViewModelBase.cs b/UIShare/ViewModelBase/NavigateViewModelBase.cs deleted file mode 100644 index fcee644..0000000 --- a/UIShare/ViewModelBase/NavigateViewModelBase.cs +++ /dev/null @@ -1,60 +0,0 @@ -using Notifications.Wpf.Core; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace UIShare.ViewModelBase -{ - public abstract class NavigateViewModelBase : BindableBase, INavigationAware - { - public DialogCloseListener RequestClose { get; set; } - public IEventAggregator _eventAggregator; - public IDialogService _dialogService; - public IRegionManager _regionManager; - private INotificationManager _notificationManager; - public NavigateViewModelBase(IContainerProvider containerProvider) - { - _eventAggregator = containerProvider.Resolve(); - _dialogService = containerProvider.Resolve(); - _regionManager = containerProvider.Resolve(); - _notificationManager = containerProvider.Resolve(); - } - - protected void ShowInfoMessageBox(string Message,Action callback) - { - var dialogParams = new DialogParameters(); - dialogParams.Add("Title", "提示"); - dialogParams.Add("Message", Message); - dialogParams.Add("Icon", "info"); - dialogParams.Add("ShowOk", true); - _dialogService.ShowDialog("MessageBoxView", dialogParams, result => - { - callback(); - }); - } - protected void ShowErrorMessageBox(string Message,Action callback) - { - var dialogParams = new DialogParameters(); - dialogParams.Add("Title", "错误"); - dialogParams.Add("Message", Message); - dialogParams.Add("Icon", "info"); - dialogParams.Add("ShowOk", true); - _dialogService.ShowDialog("MessageBoxView", dialogParams, result => - { - callback(); - }); - } - #region Navigation - - public virtual void OnNavigatedTo(NavigationContext navigationContext) { } - - public virtual bool IsNavigationTarget(NavigationContext navigationContext) => true; - - public virtual void OnNavigatedFrom(NavigationContext navigationContext) { } - - #endregion - } - -} diff --git a/UpdateInfoModule/UpdateInfoModule.cs b/UpdateInfoModule/UpdateInfoModule.cs deleted file mode 100644 index d27816d..0000000 --- a/UpdateInfoModule/UpdateInfoModule.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Reflection; -using UpdateInfoModule.Views; - -namespace UpdateInfoModule -{ - public class UpdateInfoModule : IModule - { - public void OnInitialized(IContainerProvider containerProvider) - { - IRegionManager regionManager = containerProvider.Resolve(); - regionManager.RegisterViewWithRegion("ShellViewManager", typeof(UpdateInfoView)); - } - - public void RegisterTypes(IContainerRegistry containerRegistry) - { - containerRegistry.RegisterForNavigation("UpdateInfoView"); - } - } -} diff --git a/UpdateInfoModule/UpdateInfoModule.csproj b/UpdateInfoModule/UpdateInfoModule.csproj deleted file mode 100644 index 9c40ada..0000000 --- a/UpdateInfoModule/UpdateInfoModule.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - net8.0-windows - enable - true - enable - - - - - - - - - Code - - - - diff --git a/UpdateInfoModule/ViewModels/UpdateInfoViewModel.cs b/UpdateInfoModule/ViewModels/UpdateInfoViewModel.cs deleted file mode 100644 index 68bd2db..0000000 --- a/UpdateInfoModule/ViewModels/UpdateInfoViewModel.cs +++ /dev/null @@ -1,30 +0,0 @@ -using UIShare.ViewModelBase; - -namespace UpdateInfoModule.ViewModels -{ - public class UpdateInfoViewModel : NavigateViewModelBase - { - #region 属性 - - - #endregion - #region 命令 - - - - #endregion - - public UpdateInfoViewModel(IContainerProvider containerProvider) : base(containerProvider) - { - - - } - #region 命令处理 - - - - #endregion - - - } -} diff --git a/UpdateInfoModule/Views/UpdateInfoView.xaml b/UpdateInfoModule/Views/UpdateInfoView.xaml deleted file mode 100644 index d3a7199..0000000 --- a/UpdateInfoModule/Views/UpdateInfoView.xaml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - diff --git a/UpdateInfoModule/Views/UpdateInfoView.xaml.cs b/UpdateInfoModule/Views/UpdateInfoView.xaml.cs deleted file mode 100644 index fd8f576..0000000 --- a/UpdateInfoModule/Views/UpdateInfoView.xaml.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace UpdateInfoModule.Views -{ - /// - /// UpdateInfoView.xaml 的交互逻辑 - /// - public partial class UpdateInfoView : UserControl - { - public UpdateInfoView() - { - InitializeComponent(); - } - } -}