From 4059da4950b2e2a24f653bf86a904c0430be95c1 Mon Sep 17 00:00:00 2001 From: "GukSang.Jin" Date: Sat, 30 May 2026 10:11:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B02026530?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FootwearTest/App.axaml | 67 ++++++++++ FootwearTest/FootwearTest.csproj | 8 +- .../ViewModels/MainWindowViewModel.cs | 44 +++++-- FootwearTest/Views/DashboardView.axaml | 10 +- FootwearTest/Views/HistoryView.axaml | 6 +- FootwearTest/Views/MainWindow.axaml | 116 ++++++++++++------ FootwearTest/Views/MainWindow.axaml.cs | 2 +- FootwearTest/Views/MethodAView.axaml | 14 +-- FootwearTest/Views/MethodBView.axaml | 16 +-- FootwearTest/Views/ReportView.axaml | 4 +- FootwearTest/Views/SettingsView.axaml | 6 +- 11 files changed, 213 insertions(+), 80 deletions(-) diff --git a/FootwearTest/App.axaml b/FootwearTest/App.axaml index 71b189c..a8f206f 100644 --- a/FootwearTest/App.axaml +++ b/FootwearTest/App.axaml @@ -6,11 +6,78 @@ RequestedThemeVariant="Default"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FootwearTest/FootwearTest.csproj b/FootwearTest/FootwearTest.csproj index fd5e3cb..b844c4e 100644 --- a/FootwearTest/FootwearTest.csproj +++ b/FootwearTest/FootwearTest.csproj @@ -13,10 +13,10 @@ - - - - + + + + None All diff --git a/FootwearTest/ViewModels/MainWindowViewModel.cs b/FootwearTest/ViewModels/MainWindowViewModel.cs index 83b714c..b97ee49 100644 --- a/FootwearTest/ViewModels/MainWindowViewModel.cs +++ b/FootwearTest/ViewModels/MainWindowViewModel.cs @@ -69,6 +69,7 @@ public partial class MainWindowViewModel : ViewModelBase private string _currentPageTitle = ""; private DeviceSnapshot _snapshot = DeviceSnapshot.Initial; private string _connectionText = "未连接"; + private string _selectedPageKey = "Dashboard"; public ViewModelBase CurrentPage { @@ -94,17 +95,29 @@ public partial class MainWindowViewModel : ViewModelBase set => SetProperty(ref _connectionText, value); } - private void ShowDashboard() => Navigate(Dashboard, "运行总览"); + public bool IsDashboardSelected => _selectedPageKey == "Dashboard"; - private void ShowMethodA() => Navigate(MethodA, "方法 A - 热阻/湿阻"); + public bool IsMethodASelected => _selectedPageKey == "MethodA"; - private void ShowMethodB() => Navigate(MethodB, "方法 B - 吸湿透水汽/保暖"); + public bool IsMethodBSelected => _selectedPageKey == "MethodB"; - private void ShowHistory() => Navigate(History, "历史记录"); + public bool IsHistorySelected => _selectedPageKey == "History"; - private void ShowReport() => Navigate(Report, "试验报告"); + public bool IsReportSelected => _selectedPageKey == "Report"; - private void ShowSettings() => Navigate(Settings, "系统设置"); + public bool IsSettingsSelected => _selectedPageKey == "Settings"; + + private void ShowDashboard() => Navigate(Dashboard, "运行总览", "Dashboard"); + + private void ShowMethodA() => Navigate(MethodA, "方法 A - 热阻/湿阻", "MethodA"); + + private void ShowMethodB() => Navigate(MethodB, "方法 B - 吸湿透水汽/保暖", "MethodB"); + + private void ShowHistory() => Navigate(History, "历史记录", "History"); + + private void ShowReport() => Navigate(Report, "试验报告", "Report"); + + private void ShowSettings() => Navigate(Settings, "系统设置", "Settings"); private async Task ConnectDeviceAsync() { @@ -136,11 +149,28 @@ public partial class MainWindowViewModel : ViewModelBase } } - private void Navigate(ViewModelBase page, string title) + private void Navigate(ViewModelBase page, string title, string pageKey) { _logger.LogInformation("Navigating. PageTitle={PageTitle}", title); CurrentPage = page; CurrentPageTitle = title; + SetSelectedPageKey(pageKey); + } + + private void SetSelectedPageKey(string pageKey) + { + if (_selectedPageKey == pageKey) + { + return; + } + + _selectedPageKey = pageKey; + OnPropertyChanged(nameof(IsDashboardSelected)); + OnPropertyChanged(nameof(IsMethodASelected)); + OnPropertyChanged(nameof(IsMethodBSelected)); + OnPropertyChanged(nameof(IsHistorySelected)); + OnPropertyChanged(nameof(IsReportSelected)); + OnPropertyChanged(nameof(IsSettingsSelected)); } private async Task RefreshSnapshotAsync() diff --git a/FootwearTest/Views/DashboardView.axaml b/FootwearTest/Views/DashboardView.axaml index 652ebaa..c62a078 100644 --- a/FootwearTest/Views/DashboardView.axaml +++ b/FootwearTest/Views/DashboardView.axaml @@ -7,26 +7,26 @@ - + - + - + - + @@ -35,7 +35,7 @@ - + diff --git a/FootwearTest/Views/HistoryView.axaml b/FootwearTest/Views/HistoryView.axaml index 8cd2eb2..4065de9 100644 --- a/FootwearTest/Views/HistoryView.axaml +++ b/FootwearTest/Views/HistoryView.axaml @@ -5,7 +5,7 @@ x:Class="FootwearTest.Views.HistoryView" x:DataType="vm:HistoryViewModel"> - + @@ -25,11 +25,11 @@ - + - - - - - - + - + +