From 614dfa4063257ad18e7237a90bd1c0f469b4572b Mon Sep 17 00:00:00 2001 From: "David P.G" Date: Sun, 24 Aug 2025 11:31:07 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=E4=BA=86=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E5=AF=B9=E8=AF=9D=E6=A1=86=E7=9A=84=E5=B8=83?= =?UTF-8?q?=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DMS.WPF/DMS.WPF.csproj | 5 - DMS.WPF/Helper/MenuHelper.cs | 1 + DMS.WPF/Services/DialogService.cs | 3 +- DMS.WPF/ViewModels/DeviceDetailViewModel.cs | 2 +- DMS.WPF/ViewModels/DevicesViewModel.cs | 12 +- ...ViewModel.cs => ConfirmDialogViewModel.cs} | 4 +- .../ViewModels/Items/DeviceItemViewModel.cs | 8 +- DMS.WPF/ViewModels/VariableTableViewModel.cs | 3 +- DMS.WPF/Views/Dialogs/ConfirmDialog.xaml | 58 ++-- DMS.WPF/Views/Dialogs/DeviceDialog.xaml | 280 +++++++++++------- .../HandyDialogs/VariableEditorDialog.xaml | 87 ------ .../HandyDialogs/VariableEditorDialog.xaml.cs | 16 - DMS.WPF/Views/MainView.xaml | 131 ++++---- 13 files changed, 273 insertions(+), 337 deletions(-) rename DMS.WPF/ViewModels/Dialogs/{ConfrimDialogViewModel.cs => ConfirmDialogViewModel.cs} (79%) delete mode 100644 DMS.WPF/Views/HandyDialogs/VariableEditorDialog.xaml delete mode 100644 DMS.WPF/Views/HandyDialogs/VariableEditorDialog.xaml.cs diff --git a/DMS.WPF/DMS.WPF.csproj b/DMS.WPF/DMS.WPF.csproj index 70d999b..9d7e876 100644 --- a/DMS.WPF/DMS.WPF.csproj +++ b/DMS.WPF/DMS.WPF.csproj @@ -139,11 +139,6 @@ Wpf Designer - - MSBuild:Compile - Wpf - Designer - diff --git a/DMS.WPF/Helper/MenuHelper.cs b/DMS.WPF/Helper/MenuHelper.cs index 78d86bf..9c684b7 100644 --- a/DMS.WPF/Helper/MenuHelper.cs +++ b/DMS.WPF/Helper/MenuHelper.cs @@ -17,5 +17,6 @@ public class MenuHelper // MenuAddParent(menuItem); // } // } + } } \ No newline at end of file diff --git a/DMS.WPF/Services/DialogService.cs b/DMS.WPF/Services/DialogService.cs index 90b7652..2cd6014 100644 --- a/DMS.WPF/Services/DialogService.cs +++ b/DMS.WPF/Services/DialogService.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.Threading.Tasks; using System.Windows; using DMS.WPF.Views; -using DMS.WPF.Views.HandyDialogs; using iNKORE.UI.WPF.Modern.Controls; namespace DMS.WPF.Services @@ -16,7 +15,7 @@ namespace DMS.WPF.Services private static readonly Dictionary _viewModelViewMap = new Dictionary { { typeof(DeviceDialogViewModel), typeof(DeviceDialog) }, - { typeof(ConfrimDialogViewModel), typeof(ConfirmDialog) }, + { typeof(ConfirmDialogViewModel), typeof(ConfirmDialog) }, { typeof(VariableTableDialogViewModel), typeof(VariableTableDialog) }, { typeof(ImportExcelDialogViewModel), typeof(ImportExcelDialog) }, { typeof(VariableDialogViewModel), typeof(VariableDialog) }, diff --git a/DMS.WPF/ViewModels/DeviceDetailViewModel.cs b/DMS.WPF/ViewModels/DeviceDetailViewModel.cs index ba9db76..ecfb584 100644 --- a/DMS.WPF/ViewModels/DeviceDetailViewModel.cs +++ b/DMS.WPF/ViewModels/DeviceDetailViewModel.cs @@ -126,7 +126,7 @@ public partial class DeviceDetailViewModel : ViewModelBase, INavigatable } string message = $"确认要删除变量表名为:{SelectedVariableTable.Name} \n\n此操作将同时删除该变量表下的所有变量数据,且无法恢复!"; - ConfrimDialogViewModel viewModel = new ConfrimDialogViewModel("删除变量表",message,"删除"); + ConfirmDialogViewModel viewModel = new ConfirmDialogViewModel("删除变量表",message,"删除"); var res = await _dialogService.ShowDialogAsync(viewModel); if (res) { diff --git a/DMS.WPF/ViewModels/DevicesViewModel.cs b/DMS.WPF/ViewModels/DevicesViewModel.cs index 44cfe14..0a755da 100644 --- a/DMS.WPF/ViewModels/DevicesViewModel.cs +++ b/DMS.WPF/ViewModels/DevicesViewModel.cs @@ -85,12 +85,12 @@ public partial class DevicesViewModel : ViewModelBase, INavigatable { try { - DeviceDialogViewModel deviceDialogViewModel = new DeviceDialogViewModel() - { - PrimaryButText = "添加设备" - }; // 1. 显示添加设备对话框 - DeviceItemViewModel device = await _dialogService.ShowDialogAsync(deviceDialogViewModel); + DeviceItemViewModel device = await _dialogService.ShowDialogAsync(new DeviceDialogViewModel() + { + Title = "添加设备", + PrimaryButText = "添加设备" + }); // 如果用户取消或对话框未返回设备,则直接返回 if (device == null) { @@ -156,7 +156,7 @@ public partial class DevicesViewModel : ViewModelBase, INavigatable } - if (await _dialogService.ShowDialogAsync(new ConfrimDialogViewModel("删除设备",$"确认要删除设备名为:{SelectedDevice.Name}","删除设备"))) + if (await _dialogService.ShowDialogAsync(new ConfirmDialogViewModel("删除设备",$"确认要删除设备名为:{SelectedDevice.Name}","删除设备"))) { var isDel = await _deviceAppService.DeleteDeviceByIdAsync(SelectedDevice.Id); if (isDel) diff --git a/DMS.WPF/ViewModels/Dialogs/ConfrimDialogViewModel.cs b/DMS.WPF/ViewModels/Dialogs/ConfirmDialogViewModel.cs similarity index 79% rename from DMS.WPF/ViewModels/Dialogs/ConfrimDialogViewModel.cs rename to DMS.WPF/ViewModels/Dialogs/ConfirmDialogViewModel.cs index ef74686..de5e367 100644 --- a/DMS.WPF/ViewModels/Dialogs/ConfrimDialogViewModel.cs +++ b/DMS.WPF/ViewModels/Dialogs/ConfirmDialogViewModel.cs @@ -3,13 +3,13 @@ using CommunityToolkit.Mvvm.Input; namespace DMS.WPF.ViewModels.Dialogs; -public partial class ConfrimDialogViewModel : DialogViewModelBase +public partial class ConfirmDialogViewModel : DialogViewModelBase { [ObservableProperty] private string _message; - public ConfrimDialogViewModel(string title,string message,string primaryButText) + public ConfirmDialogViewModel(string title,string message,string primaryButText) { Message = message; Title = title; diff --git a/DMS.WPF/ViewModels/Items/DeviceItemViewModel.cs b/DMS.WPF/ViewModels/Items/DeviceItemViewModel.cs index f732e8c..faaa99b 100644 --- a/DMS.WPF/ViewModels/Items/DeviceItemViewModel.cs +++ b/DMS.WPF/ViewModels/Items/DeviceItemViewModel.cs @@ -27,10 +27,10 @@ public partial class DeviceItemViewModel : ObservableObject private string _ipAddress; [ObservableProperty] - private int _port; + private int _port=102; [ObservableProperty] - private int _rack; + private int _rack=1; [ObservableProperty] private int _slot; @@ -45,7 +45,7 @@ public partial class DeviceItemViewModel : ObservableObject private string _opcUaServerUrl; [ObservableProperty] - private bool _isActive; + private bool _isActive =true; [ObservableProperty] private bool _isRunning; @@ -54,7 +54,7 @@ public partial class DeviceItemViewModel : ObservableObject private string _status; [ObservableProperty] - private bool _isAddDefVarTable; + private bool _isAddDefVarTable=true; partial void OnIpAddressChanged(string newIpAddress) { diff --git a/DMS.WPF/ViewModels/VariableTableViewModel.cs b/DMS.WPF/ViewModels/VariableTableViewModel.cs index 238f192..865b675 100644 --- a/DMS.WPF/ViewModels/VariableTableViewModel.cs +++ b/DMS.WPF/ViewModels/VariableTableViewModel.cs @@ -16,7 +16,6 @@ using DMS.Application.Interfaces; using DMS.Application.Services; using DMS.Helper; using DMS.WPF.Views; -using DMS.WPF.Views.HandyDialogs; using HandyControl.Controls; using HandyControl.Data; using HandyControl.Tools.Extension; @@ -314,7 +313,7 @@ partial class VariableTableViewModel : ViewModelBase, INavigatable // // 拼接要删除的变量名称,用于确认提示 var existNames = string.Join("、", existList.Select(v => v.Name)); var confrimDialogViewModel - = new ConfrimDialogViewModel("存在已经添加的变量", $"变量名称:{existNames},已经存在,是否跳过继续添加其他的变量。取消则不添加任何变量", "继续"); + = new ConfirmDialogViewModel("存在已经添加的变量", $"变量名称:{existNames},已经存在,是否跳过继续添加其他的变量。取消则不添加任何变量", "继续"); var res = await _dialogService.ShowDialogAsync(confrimDialogViewModel); if (!res) return; // 从导入列表中删除已经存在的变量 diff --git a/DMS.WPF/Views/Dialogs/ConfirmDialog.xaml b/DMS.WPF/Views/Dialogs/ConfirmDialog.xaml index e0adb70..6a05aef 100644 --- a/DMS.WPF/Views/Dialogs/ConfirmDialog.xaml +++ b/DMS.WPF/Views/Dialogs/ConfirmDialog.xaml @@ -1,38 +1,28 @@ - - - - - - - - - + - - - + + \ No newline at end of file diff --git a/DMS.WPF/Views/Dialogs/DeviceDialog.xaml b/DMS.WPF/Views/Dialogs/DeviceDialog.xaml index feb01d6..d68dc08 100644 --- a/DMS.WPF/Views/Dialogs/DeviceDialog.xaml +++ b/DMS.WPF/Views/Dialogs/DeviceDialog.xaml @@ -1,23 +1,23 @@ - + @@ -26,45 +26,64 @@ - - - - - - - - - - + + + + + + + + + + + + + + - - - + + - + - + + + + + + @@ -72,24 +91,15 @@ - - - - - - - - - - - + @@ -97,50 +107,92 @@ - - - - - - - - - + + + - - - - - - - - - - - - - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DMS.WPF/Views/HandyDialogs/VariableEditorDialog.xaml b/DMS.WPF/Views/HandyDialogs/VariableEditorDialog.xaml deleted file mode 100644 index 0766361..0000000 --- a/DMS.WPF/Views/HandyDialogs/VariableEditorDialog.xaml +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -