From 4cfaab0a6754f78bdce02d04dc03045722d3e5e0 Mon Sep 17 00:00:00 2001 From: Richasy Date: Sat, 29 Jun 2024 17:52:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E9=9A=90=E8=97=8F=E4=BE=A7?= =?UTF-8?q?=E8=BE=B9=E6=A0=8F=20(#43)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 支持隐藏侧边栏 * 更新迁移根目录配置 --- src/Core/RodelAgent.Context/MigrationUtils.cs | 13 +- .../Constants/SettingNames.cs | 4 + src/Desktop/RodelAgent.UI/App.xaml.cs | 1 + .../Controls/Base/VisibilityToggleButton.xaml | 47 ++++ .../Base/VisibilityToggleButton.xaml.cs | 132 +++++++++ .../RodelAgent.UI/Pages/AudioServicePage.xaml | 18 +- .../Pages/AudioServicePage.xaml.cs | 3 + .../RodelAgent.UI/Pages/ChatServicePage.xaml | 252 ++++++++++-------- .../Pages/ChatServicePage.xaml.cs | 6 + .../RodelAgent.UI/Pages/DrawServicePage.xaml | 18 +- .../Pages/DrawServicePage.xaml.cs | 3 + .../Resources/en-US/Resources.resw | 3 + .../Resources/zh-Hans-CN/Resources.resw | 3 + .../RodelAgent.UI/RodelAgent.UI.csproj | 15 +- .../AudioServicePageViewModel.Properties.cs | 3 + .../AudioServicePageViewModel.cs | 6 + .../ChatServicePageViewModel.Properties.cs | 6 + .../ChatServicePageViewModel.cs | 8 + .../DrawServicePageViewModel.Properties.cs | 3 + .../DrawServicePageViewModel.cs | 6 + 20 files changed, 428 insertions(+), 122 deletions(-) create mode 100644 src/Desktop/RodelAgent.UI/Controls/Base/VisibilityToggleButton.xaml create mode 100644 src/Desktop/RodelAgent.UI/Controls/Base/VisibilityToggleButton.xaml.cs diff --git a/src/Core/RodelAgent.Context/MigrationUtils.cs b/src/Core/RodelAgent.Context/MigrationUtils.cs index 223a89fb..606cc333 100644 --- a/src/Core/RodelAgent.Context/MigrationUtils.cs +++ b/src/Core/RodelAgent.Context/MigrationUtils.cs @@ -7,8 +7,16 @@ namespace RodelAgent.Context; /// /// 数据库迁移工具. /// -internal static class MigrationUtils +public static class MigrationUtils { + private static string _rootPath; + + /// + /// 设置根目录. + /// + /// 应用安装目录. + public static void SetRootPath(string rootPath) => _rootPath = rootPath; + /// /// 获取密钥数据库. /// @@ -71,7 +79,8 @@ private static async Task CheckDatabaseExistInternalAsync(string dbName, string var targetDbPath = Path.Combine(workDir, dbName); if (!File.Exists(targetDbPath)) { - var emptyDb = Path.Combine(AppContext.BaseDirectory, "Assets", dbName); + var rootPath = string.IsNullOrEmpty(_rootPath) ? AppContext.BaseDirectory : _rootPath; + var emptyDb = Path.Combine(rootPath, "Assets", dbName); await Task.Run(() => File.Copy(emptyDb, targetDbPath)); } } diff --git a/src/Desktop/RodelAgent.UI.Models/Constants/SettingNames.cs b/src/Desktop/RodelAgent.UI.Models/Constants/SettingNames.cs index 894ac95a..32b554d1 100644 --- a/src/Desktop/RodelAgent.UI.Models/Constants/SettingNames.cs +++ b/src/Desktop/RodelAgent.UI.Models/Constants/SettingNames.cs @@ -42,4 +42,8 @@ public enum SettingNames LastSelectedGroup, ChatGroupPanelType, AppLanguage, + IsChatServicePageServiceColumnManualHide, + IsChatServicePageExtraColumnManualHide, + IsDrawHistoryColumnManualHide, + IsAudioHistoryColumnManualHide, } diff --git a/src/Desktop/RodelAgent.UI/App.xaml.cs b/src/Desktop/RodelAgent.UI/App.xaml.cs index b15079ab..d1ac1824 100644 --- a/src/Desktop/RodelAgent.UI/App.xaml.cs +++ b/src/Desktop/RodelAgent.UI/App.xaml.cs @@ -30,6 +30,7 @@ public partial class App : Application public App() { InitializeComponent(); + RodelAgent.Context.MigrationUtils.SetRootPath(Windows.ApplicationModel.Package.Current.InstalledPath); var language = SettingsToolkit.ReadLocalSetting(SettingNames.AppLanguage, "default"); ApplicationLanguages.PrimaryLanguageOverride = language != "default" ? language diff --git a/src/Desktop/RodelAgent.UI/Controls/Base/VisibilityToggleButton.xaml b/src/Desktop/RodelAgent.UI/Controls/Base/VisibilityToggleButton.xaml new file mode 100644 index 00000000..06c987dc --- /dev/null +++ b/src/Desktop/RodelAgent.UI/Controls/Base/VisibilityToggleButton.xaml @@ -0,0 +1,47 @@ + + + + + + + + diff --git a/src/Desktop/RodelAgent.UI/Controls/Base/VisibilityToggleButton.xaml.cs b/src/Desktop/RodelAgent.UI/Controls/Base/VisibilityToggleButton.xaml.cs new file mode 100644 index 00000000..6d4295b9 --- /dev/null +++ b/src/Desktop/RodelAgent.UI/Controls/Base/VisibilityToggleButton.xaml.cs @@ -0,0 +1,132 @@ +// Copyright (c) Rodel. All rights reserved. + +using Microsoft.UI.Xaml.Automation; +using Microsoft.UI.Xaml.Media; +using RodelAgent.UI.Toolkits; + +namespace RodelAgent.UI.Controls; + +/// +/// 可见性切换按钮. +/// +public sealed partial class VisibilityToggleButton : UserControl +{ + /// + /// 依赖属性. + /// + public static readonly DependencyProperty DirectionProperty = + DependencyProperty.Register(nameof(Direction), typeof(VisibilityToggleButtonDirection), typeof(VisibilityToggleButton), new PropertyMetadata(VisibilityToggleButtonDirection.LeftToRightVisible)); + + /// + /// 依赖属性. + /// + public static readonly DependencyProperty IsHideProperty = + DependencyProperty.Register(nameof(IsHide), typeof(bool), typeof(VisibilityToggleButton), new PropertyMetadata(default, new PropertyChangedCallback(OnIsHideChanged))); + + /// + /// Initializes a new instance of the class. + /// + public VisibilityToggleButton() + { + InitializeComponent(); + Loaded += OnLoaded; + } + + /// + /// 点击事件. + /// + public event EventHandler Click; + + /// + /// 获取或设置方向. + /// + public VisibilityToggleButtonDirection Direction + { + get => (VisibilityToggleButtonDirection)GetValue(DirectionProperty); + set => SetValue(DirectionProperty, value); + } + + /// + /// 是否已经隐藏指定目标. + /// + public bool IsHide + { + get => (bool)GetValue(IsHideProperty); + set => SetValue(IsHideProperty, value); + } + + /// + protected override void OnPointerEntered(PointerRoutedEventArgs e) + => ShowButton(); + + /// + protected override void OnPointerMoved(PointerRoutedEventArgs e) + => ShowButton(); + + /// + protected override void OnPointerExited(PointerRoutedEventArgs e) + => HideButton(); + + /// + protected override void OnPointerCanceled(PointerRoutedEventArgs e) + => HideButton(); + + private static void OnIsHideChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + var instance = d as VisibilityToggleButton; + instance?.CheckButtonStates(); + } + + private void OnLoaded(object sender, RoutedEventArgs e) + => CheckButtonStates(); + + private void CheckButtonStates() + { + var symbol = IsHide + ? Direction == VisibilityToggleButtonDirection.LeftToRightVisible ? FluentIcons.Common.Symbol.ChevronRight : FluentIcons.Common.Symbol.ChevronLeft + : Direction == VisibilityToggleButtonDirection.LeftToRightVisible ? FluentIcons.Common.Symbol.ChevronLeft : FluentIcons.Common.Symbol.ChevronRight; + Icon.Symbol = symbol; + var tip = IsHide ? ResourceToolkit.GetLocalizedString(Models.Constants.StringNames.Show) : ResourceToolkit.GetLocalizedString(Models.Constants.StringNames.Hide); + ToolTipService.SetToolTip(Btn, tip); + AutomationProperties.SetName(Btn, tip); + + var container = VisualTreeHelper.GetParent(this) as FrameworkElement; + if (container is not null) + { + container.Margin = IsHide + ? Direction == VisibilityToggleButtonDirection.LeftToRightVisible ? new Thickness(-4, 0, 0, 0) : new Thickness(0, 0, -4, 0) + : new Thickness(0); + } + } + + private void OnBtnClick(object sender, RoutedEventArgs e) + => Click?.Invoke(this, EventArgs.Empty); + + private void ShowButton() + { + BackGrid.Visibility = Visibility.Visible; + Btn.Visibility = Visibility.Visible; + } + + private void HideButton() + { + BackGrid.Visibility = Visibility.Collapsed; + Btn.Visibility = Visibility.Collapsed; + } +} + +/// +/// 可见性切换按钮方向. +/// +public enum VisibilityToggleButtonDirection +{ + /// + /// 需要控制的内容在左侧. + /// + LeftToRightVisible, + + /// + /// 需要控制的内容在右侧. + /// + RightToLeftVisible, +} diff --git a/src/Desktop/RodelAgent.UI/Pages/AudioServicePage.xaml b/src/Desktop/RodelAgent.UI/Pages/AudioServicePage.xaml index 877e3ddf..f594fd5b 100644 --- a/src/Desktop/RodelAgent.UI/Pages/AudioServicePage.xaml +++ b/src/Desktop/RodelAgent.UI/Pages/AudioServicePage.xaml @@ -93,7 +93,8 @@ Grid.Column="2" Width="{x:Bind ViewModel.HistoryColumnWidth, Mode=OneWay}" Margin="-6,0,0,0" - Background="{ThemeResource LayerFillColorDefaultBrush}"> + Background="{ThemeResource LayerFillColorDefaultBrush}" + Visibility="{x:Bind ViewModel.IsHistoryColumnManualHide, Mode=OneWay, Converter={StaticResource BoolToVisibilityReverseConverter}}"> @@ -103,13 +104,22 @@ Width="1" HorizontalAlignment="Center" VerticalAlignment="Stretch" - Background="{ThemeResource DividerStrokeColorDefaultBrush}" /> + Background="{ThemeResource DividerStrokeColorDefaultBrush}" + Visibility="{x:Bind ViewModel.IsHistoryColumnManualHide, Mode=OneWay, Converter={StaticResource BoolToVisibilityReverseConverter}}" /> + Minimum="240" + Visibility="{x:Bind ViewModel.IsHistoryColumnManualHide, Mode=OneWay, Converter={StaticResource BoolToVisibilityReverseConverter}}" /> + diff --git a/src/Desktop/RodelAgent.UI/Pages/AudioServicePage.xaml.cs b/src/Desktop/RodelAgent.UI/Pages/AudioServicePage.xaml.cs index 8c04fa30..6d003eda 100644 --- a/src/Desktop/RodelAgent.UI/Pages/AudioServicePage.xaml.cs +++ b/src/Desktop/RodelAgent.UI/Pages/AudioServicePage.xaml.cs @@ -26,6 +26,9 @@ protected override void OnPageLoaded() ViewModel.ResetAvailableAudioServicesCommand.Execute(default); } } + + private void OnHistoryVisibilityButtonClick(object sender, EventArgs e) + => ViewModel.IsHistoryColumnManualHide = !ViewModel.IsHistoryColumnManualHide; } /// diff --git a/src/Desktop/RodelAgent.UI/Pages/ChatServicePage.xaml b/src/Desktop/RodelAgent.UI/Pages/ChatServicePage.xaml index 81eeb9ae..fadf31ad 100644 --- a/src/Desktop/RodelAgent.UI/Pages/ChatServicePage.xaml +++ b/src/Desktop/RodelAgent.UI/Pages/ChatServicePage.xaml @@ -29,7 +29,10 @@ - + @@ -91,134 +94,143 @@ - - - - - - - - + + + - + - + + + + + + + + + + + + + - - + - - - - - - - - - - - - - + + - + - + + + + + + + + + + + + + - - + - - - - + - - + + + + + @@ -227,13 +239,22 @@ Width="1" HorizontalAlignment="Center" VerticalAlignment="Stretch" - Background="{ThemeResource DividerStrokeColorDefaultBrush}" /> + Background="{ThemeResource DividerStrokeColorDefaultBrush}" + Visibility="{x:Bind ViewModel.IsExtraColumnManualHide, Mode=OneWay, Converter={StaticResource BoolToVisibilityReverseConverter}}" /> + Minimum="220" + Visibility="{x:Bind ViewModel.IsExtraColumnManualHide, Mode=OneWay, Converter={StaticResource BoolToVisibilityReverseConverter}}" /> + @@ -242,13 +263,22 @@ Width="1" HorizontalAlignment="Center" VerticalAlignment="Stretch" - Background="{ThemeResource DividerStrokeColorDefaultBrush}" /> + Background="{ThemeResource DividerStrokeColorDefaultBrush}" + Visibility="{x:Bind ViewModel.IsExtraColumnManualHide, Mode=OneWay, Converter={StaticResource BoolToVisibilityReverseConverter}}" /> + Minimum="220" + Visibility="{x:Bind ViewModel.IsExtraColumnManualHide, Mode=OneWay, Converter={StaticResource BoolToVisibilityReverseConverter}}" /> + diff --git a/src/Desktop/RodelAgent.UI/Pages/ChatServicePage.xaml.cs b/src/Desktop/RodelAgent.UI/Pages/ChatServicePage.xaml.cs index 02918d33..2069ad6a 100644 --- a/src/Desktop/RodelAgent.UI/Pages/ChatServicePage.xaml.cs +++ b/src/Desktop/RodelAgent.UI/Pages/ChatServicePage.xaml.cs @@ -127,6 +127,12 @@ private void OnGroupPanelTypeChanged(SelectorBar sender, SelectorBarSelectionCha var currentType = (ChatGroupPanelType)GroupPanelTypeSelector.SelectedItem.Tag; ViewModel.GroupPanelType = currentType; } + + private void OnExtraVisibilityButtonClick(object sender, EventArgs e) + => ViewModel.IsExtraColumnManualHide = !ViewModel.IsExtraColumnManualHide; + + private void OnServiceVisibilityButtonClick(object sender, EventArgs e) + => ViewModel.IsServiceColumnManualHide = !ViewModel.IsServiceColumnManualHide; } /// diff --git a/src/Desktop/RodelAgent.UI/Pages/DrawServicePage.xaml b/src/Desktop/RodelAgent.UI/Pages/DrawServicePage.xaml index 9c257456..05ddde26 100644 --- a/src/Desktop/RodelAgent.UI/Pages/DrawServicePage.xaml +++ b/src/Desktop/RodelAgent.UI/Pages/DrawServicePage.xaml @@ -94,7 +94,8 @@ Grid.Column="2" Width="{x:Bind ViewModel.HistoryColumnWidth, Mode=OneWay}" Margin="-6,0,0,0" - Background="{ThemeResource LayerFillColorDefaultBrush}"> + Background="{ThemeResource LayerFillColorDefaultBrush}" + Visibility="{x:Bind ViewModel.IsHistoryColumnManualHide, Mode=OneWay, Converter={StaticResource BoolToVisibilityReverseConverter}}"> @@ -104,13 +105,22 @@ Width="1" HorizontalAlignment="Center" VerticalAlignment="Stretch" - Background="{ThemeResource DividerStrokeColorDefaultBrush}" /> + Background="{ThemeResource DividerStrokeColorDefaultBrush}" + Visibility="{x:Bind ViewModel.IsHistoryColumnManualHide, Mode=OneWay, Converter={StaticResource BoolToVisibilityReverseConverter}}" /> + Minimum="240" + Visibility="{x:Bind ViewModel.IsHistoryColumnManualHide, Mode=OneWay, Converter={StaticResource BoolToVisibilityReverseConverter}}" /> + diff --git a/src/Desktop/RodelAgent.UI/Pages/DrawServicePage.xaml.cs b/src/Desktop/RodelAgent.UI/Pages/DrawServicePage.xaml.cs index 20fb71c1..f70b42d4 100644 --- a/src/Desktop/RodelAgent.UI/Pages/DrawServicePage.xaml.cs +++ b/src/Desktop/RodelAgent.UI/Pages/DrawServicePage.xaml.cs @@ -26,6 +26,9 @@ protected override void OnPageLoaded() ViewModel.ResetAvailableDrawServicesCommand.Execute(default); } } + + private void OnHistoryVisibilityButtonClick(object sender, EventArgs e) + => ViewModel.IsHistoryColumnManualHide = !ViewModel.IsHistoryColumnManualHide; } /// diff --git a/src/Desktop/RodelAgent.UI/Resources/en-US/Resources.resw b/src/Desktop/RodelAgent.UI/Resources/en-US/Resources.resw index 4bb0ed56..49d58175 100644 --- a/src/Desktop/RodelAgent.UI/Resources/en-US/Resources.resw +++ b/src/Desktop/RodelAgent.UI/Resources/en-US/Resources.resw @@ -955,6 +955,9 @@ You can manually adjust the limit, and the application will capture the specifie Share + + Show + Show information diff --git a/src/Desktop/RodelAgent.UI/Resources/zh-Hans-CN/Resources.resw b/src/Desktop/RodelAgent.UI/Resources/zh-Hans-CN/Resources.resw index 6f5520d7..72de5396 100644 --- a/src/Desktop/RodelAgent.UI/Resources/zh-Hans-CN/Resources.resw +++ b/src/Desktop/RodelAgent.UI/Resources/zh-Hans-CN/Resources.resw @@ -955,6 +955,9 @@ 分享 + + 显示 + 查看说明 diff --git a/src/Desktop/RodelAgent.UI/RodelAgent.UI.csproj b/src/Desktop/RodelAgent.UI/RodelAgent.UI.csproj index 2febabea..743559d1 100644 --- a/src/Desktop/RodelAgent.UI/RodelAgent.UI.csproj +++ b/src/Desktop/RodelAgent.UI/RodelAgent.UI.csproj @@ -14,6 +14,13 @@ Assets\logo.ico false + + + + + + + @@ -48,6 +55,7 @@ + @@ -608,6 +616,9 @@ MSBuild:Compile + + MSBuild:Compile + Always @@ -846,7 +857,6 @@ - @@ -862,4 +872,7 @@ + + + diff --git a/src/Desktop/RodelAgent.UI/ViewModels/Pages/AudioServicePageViewModel/AudioServicePageViewModel.Properties.cs b/src/Desktop/RodelAgent.UI/ViewModels/Pages/AudioServicePageViewModel/AudioServicePageViewModel.Properties.cs index 3dc31ec8..05ce1cb1 100644 --- a/src/Desktop/RodelAgent.UI/ViewModels/Pages/AudioServicePageViewModel/AudioServicePageViewModel.Properties.cs +++ b/src/Desktop/RodelAgent.UI/ViewModels/Pages/AudioServicePageViewModel/AudioServicePageViewModel.Properties.cs @@ -27,6 +27,9 @@ public sealed partial class AudioServicePageViewModel [ObservableProperty] private int _historyCount; + [ObservableProperty] + private bool _isHistoryColumnManualHide; + /// /// 会话模型. /// diff --git a/src/Desktop/RodelAgent.UI/ViewModels/Pages/AudioServicePageViewModel/AudioServicePageViewModel.cs b/src/Desktop/RodelAgent.UI/ViewModels/Pages/AudioServicePageViewModel/AudioServicePageViewModel.cs index 76efbabb..03f5f6b8 100644 --- a/src/Desktop/RodelAgent.UI/ViewModels/Pages/AudioServicePageViewModel/AudioServicePageViewModel.cs +++ b/src/Desktop/RodelAgent.UI/ViewModels/Pages/AudioServicePageViewModel/AudioServicePageViewModel.cs @@ -29,6 +29,7 @@ public AudioServicePageViewModel( IsAvailableServicesEmpty = AvailableServices.Count == 0; IsHistoryEmpty = History.Count == 0; HistoryColumnWidth = SettingsToolkit.ReadLocalSetting(Models.Constants.SettingNames.AudioHistoryColumnWidth, 250d); + IsHistoryColumnManualHide = SettingsToolkit.ReadLocalSetting(Models.Constants.SettingNames.IsAudioHistoryColumnManualHide, false); History.CollectionChanged += OnHistoryCollectionChanged; } @@ -54,4 +55,9 @@ partial void OnHistoryColumnWidthChanged(double value) SettingsToolkit.WriteLocalSetting(Models.Constants.SettingNames.AudioHistoryColumnWidth, value); } } + + partial void OnIsHistoryColumnManualHideChanged(bool value) + { + SettingsToolkit.WriteLocalSetting(Models.Constants.SettingNames.IsAudioHistoryColumnManualHide, value); + } } diff --git a/src/Desktop/RodelAgent.UI/ViewModels/Pages/ChatServicePageViewModel/ChatServicePageViewModel.Properties.cs b/src/Desktop/RodelAgent.UI/ViewModels/Pages/ChatServicePageViewModel/ChatServicePageViewModel.Properties.cs index 97d9d608..24b4ff94 100644 --- a/src/Desktop/RodelAgent.UI/ViewModels/Pages/ChatServicePageViewModel/ChatServicePageViewModel.Properties.cs +++ b/src/Desktop/RodelAgent.UI/ViewModels/Pages/ChatServicePageViewModel/ChatServicePageViewModel.Properties.cs @@ -94,6 +94,12 @@ public sealed partial class ChatServicePageViewModel [ObservableProperty] private bool _isGroupChat; + [ObservableProperty] + private bool _isServiceColumnManualHide; + + [ObservableProperty] + private bool _isExtraColumnManualHide; + /// /// 可用的聊天服务. /// diff --git a/src/Desktop/RodelAgent.UI/ViewModels/Pages/ChatServicePageViewModel/ChatServicePageViewModel.cs b/src/Desktop/RodelAgent.UI/ViewModels/Pages/ChatServicePageViewModel/ChatServicePageViewModel.cs index 056afd76..d524fc9b 100644 --- a/src/Desktop/RodelAgent.UI/ViewModels/Pages/ChatServicePageViewModel/ChatServicePageViewModel.cs +++ b/src/Desktop/RodelAgent.UI/ViewModels/Pages/ChatServicePageViewModel/ChatServicePageViewModel.cs @@ -37,6 +37,8 @@ public ChatServicePageViewModel( ExtraRowHeight = SettingsToolkit.ReadLocalSetting(SettingNames.ChatServicePageExtraRowHeight, 400d); SessionPanelType = SettingsToolkit.ReadLocalSetting(SettingNames.ChatSessionPanelType, ChatSessionPanelType.SystemInstruction); GroupPanelType = SettingsToolkit.ReadLocalSetting(SettingNames.ChatGroupPanelType, ChatGroupPanelType.Agents); + IsServiceColumnManualHide = SettingsToolkit.ReadLocalSetting(SettingNames.IsChatServicePageServiceColumnManualHide, false); + IsExtraColumnManualHide = SettingsToolkit.ReadLocalSetting(SettingNames.IsChatServicePageExtraColumnManualHide, false); CheckSessionPanelType(); CheckGroupPanelType(); IsServiceSectionVisible = true; @@ -129,4 +131,10 @@ partial void OnGroupPanelTypeChanged(ChatGroupPanelType value) SettingsToolkit.WriteLocalSetting(SettingNames.ChatGroupPanelType, value); CheckGroupPanelType(); } + + partial void OnIsServiceColumnManualHideChanged(bool value) + => SettingsToolkit.WriteLocalSetting(SettingNames.IsChatServicePageServiceColumnManualHide, value); + + partial void OnIsExtraColumnManualHideChanged(bool value) + => SettingsToolkit.WriteLocalSetting(SettingNames.IsChatServicePageExtraColumnManualHide, value); } diff --git a/src/Desktop/RodelAgent.UI/ViewModels/Pages/DrawServicePageViewModel/DrawServicePageViewModel.Properties.cs b/src/Desktop/RodelAgent.UI/ViewModels/Pages/DrawServicePageViewModel/DrawServicePageViewModel.Properties.cs index 12218785..d5268d39 100644 --- a/src/Desktop/RodelAgent.UI/ViewModels/Pages/DrawServicePageViewModel/DrawServicePageViewModel.Properties.cs +++ b/src/Desktop/RodelAgent.UI/ViewModels/Pages/DrawServicePageViewModel/DrawServicePageViewModel.Properties.cs @@ -27,6 +27,9 @@ public sealed partial class DrawServicePageViewModel [ObservableProperty] private int _historyCount; + [ObservableProperty] + private bool _isHistoryColumnManualHide; + /// /// 会话模型. /// diff --git a/src/Desktop/RodelAgent.UI/ViewModels/Pages/DrawServicePageViewModel/DrawServicePageViewModel.cs b/src/Desktop/RodelAgent.UI/ViewModels/Pages/DrawServicePageViewModel/DrawServicePageViewModel.cs index 8ae64a9e..9d18d840 100644 --- a/src/Desktop/RodelAgent.UI/ViewModels/Pages/DrawServicePageViewModel/DrawServicePageViewModel.cs +++ b/src/Desktop/RodelAgent.UI/ViewModels/Pages/DrawServicePageViewModel/DrawServicePageViewModel.cs @@ -29,6 +29,7 @@ public DrawServicePageViewModel( IsAvailableServicesEmpty = AvailableServices.Count == 0; IsHistoryEmpty = History.Count == 0; HistoryColumnWidth = SettingsToolkit.ReadLocalSetting(Models.Constants.SettingNames.DrawHistoryColumnWidth, 250d); + IsHistoryColumnManualHide = SettingsToolkit.ReadLocalSetting(Models.Constants.SettingNames.IsDrawHistoryColumnManualHide, false); History.CollectionChanged += OnHistoryCollectionChanged; } @@ -54,4 +55,9 @@ partial void OnHistoryColumnWidthChanged(double value) SettingsToolkit.WriteLocalSetting(Models.Constants.SettingNames.DrawHistoryColumnWidth, value); } } + + partial void OnIsHistoryColumnManualHideChanged(bool value) + { + SettingsToolkit.WriteLocalSetting(Models.Constants.SettingNames.IsDrawHistoryColumnManualHide, value); + } }