From f86a2abed64c471d52215f2a1e58f90675affeba Mon Sep 17 00:00:00 2001 From: "David P.G" Date: Fri, 3 Oct 2025 23:06:04 +0800 Subject: [PATCH] =?UTF-8?q?=201=20feat(navigation):=20=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=BF=94=E5=9B=9E=E6=8C=89=E9=92=AE=E5=B9=B6?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=AF=BC=E8=88=AA=E5=AE=BD=E5=BA=A6=20=20=20?= =?UTF-8?q?=202=20=20=20=203=20-=20=E4=B8=BAVariableTableView=E5=92=8CDevi?= =?UTF-8?q?ceDetailView=E6=B7=BB=E5=8A=A0=E8=BF=94=E5=9B=9E=E4=B8=8A?= =?UTF-8?q?=E7=BA=A7=E9=A1=B5=E9=9D=A2=E7=9A=84=E6=8C=89=E9=92=AE=20=20=20?= =?UTF-8?q?=204=20-=20=E5=B0=86VariableHistoryView=E7=9A=84=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E6=8C=89=E9=92=AE=E6=94=B9=E4=B8=BA=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=EF=BC=8C=E4=BF=9D=E6=8C=81=E4=B8=80=E8=87=B4?= =?UTF-8?q?=E6=80=A7=20=20=20=205=20-=20=E8=B0=83=E6=95=B4MainView?= =?UTF-8?q?=E4=B8=ADNavigationView=E7=9A=84=E5=B1=95=E5=BC=80=E5=AE=BD?= =?UTF-8?q?=E5=BA=A6=EF=BC=8C=E4=BB=8E500=E5=87=8F=E5=B0=8F=E5=88=B0200=20?= =?UTF-8?q?=20=20=206=20-=20=E6=B8=85=E7=90=86=E6=9C=AA=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E5=91=BD=E5=90=8D=E7=A9=BA=E9=97=B4=E5=BC=95=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DMS.WPF/ViewModels/DeviceDetailViewModel.cs | 19 ++++++ DMS.WPF/ViewModels/VariableTableViewModel.cs | 18 ++++++ DMS.WPF/Views/DeviceDetailView.xaml | 62 ++++++++++++++------ DMS.WPF/Views/MainView.xaml | 3 +- DMS.WPF/Views/VariableHistoryView.xaml | 22 +++---- DMS.WPF/Views/VariableTableView.xaml | 38 +++++++++--- 6 files changed, 121 insertions(+), 41 deletions(-) diff --git a/DMS.WPF/ViewModels/DeviceDetailViewModel.cs b/DMS.WPF/ViewModels/DeviceDetailViewModel.cs index 4d540f0..a72e675 100644 --- a/DMS.WPF/ViewModels/DeviceDetailViewModel.cs +++ b/DMS.WPF/ViewModels/DeviceDetailViewModel.cs @@ -12,6 +12,7 @@ using DMS.WPF.Interfaces; using DMS.WPF.ViewModels.Dialogs; using DMS.WPF.ViewModels.Items; using iNKORE.UI.WPF.Modern.Common.IconKeys; +using Microsoft.Extensions.DependencyInjection; namespace DMS.WPF.ViewModels; @@ -209,4 +210,22 @@ public partial class DeviceDetailViewModel : ViewModelBase new NavigationParameter(nameof(VariableTableViewModel), SelectedVariableTable.Id, NavigationType.VariableTable)); } + + /// + /// 返回到设备列表页命令 + /// + [RelayCommand] + private async Task NavigateToDevicesList() + { + try + { + // 导航到设备列表页面 + var navigationService = App.Current.Services.GetRequiredService(); + await navigationService.NavigateToAsync(this, new NavigationParameter(nameof(DevicesViewModel), 0, NavigationType.Device)); + } + catch (Exception ex) + { + _notificationService.ShowError($"导航到设备列表失败: {ex.Message}", ex); + } + } } diff --git a/DMS.WPF/ViewModels/VariableTableViewModel.cs b/DMS.WPF/ViewModels/VariableTableViewModel.cs index 20d99b4..d8f3798 100644 --- a/DMS.WPF/ViewModels/VariableTableViewModel.cs +++ b/DMS.WPF/ViewModels/VariableTableViewModel.cs @@ -744,6 +744,24 @@ partial class VariableTableViewModel : ViewModelBase, INavigatable new NavigationParameter(nameof(VariableHistoryViewModel), SelectedVariable.Id, NavigationType.Variable)); } + /// + /// 返回到设备详情页命令 + /// + [RelayCommand] + private async Task NavigateToDeviceDetail() + { + try + { + // 导航到设备详情页面 + var navigationService = App.Current.Services.GetRequiredService(); + await navigationService.NavigateToAsync(this, new NavigationParameter(nameof(DeviceDetailViewModel), CurrentVariableTable.DeviceId, NavigationType.Device)); + } + catch (Exception ex) + { + _notificationService.ShowError($"导航到设备详情失败: {ex.Message}", ex); + } + } + /// /// 修改选定变量的历史记录设置。 /// diff --git a/DMS.WPF/Views/DeviceDetailView.xaml b/DMS.WPF/Views/DeviceDetailView.xaml index 6a4f419..45f5e80 100644 --- a/DMS.WPF/Views/DeviceDetailView.xaml +++ b/DMS.WPF/Views/DeviceDetailView.xaml @@ -73,25 +73,49 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DMS.WPF/Views/MainView.xaml b/DMS.WPF/Views/MainView.xaml index 862576b..77378f0 100644 --- a/DMS.WPF/Views/MainView.xaml +++ b/DMS.WPF/Views/MainView.xaml @@ -9,7 +9,6 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mo="clr-namespace:DMS.Core.Models;assembly=DMS.Core" xmlns:taskbarNotification="http://www.hardcodet.net/taskbar" - xmlns:tb="http://hardcodet.net/taskbar" xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern" xmlns:vm="clr-namespace:DMS.WPF.ViewModels" Title="设备管理系统" @@ -57,7 +56,7 @@ - - - - + @@ -51,10 +44,17 @@ - - - + + + + + + + + + + + + @@ -98,7 +118,8 @@ Label="Settings" /> - + + - + -