From 65e32a66cc54fd74afdfe4013253e150091717b6 Mon Sep 17 00:00:00 2001 From: Bin Date: Tue, 18 Feb 2025 16:53:06 +0800 Subject: [PATCH] feat(settings): update settings management and UI enhancements (#39) - Updated `LangVersion` to `preview` in `Directory.Build.props`. - Upgraded NuGet packages including `Microsoft.Extensions.DependencyInjection`, `Microsoft.Extensions.Hosting`, and `System.Text.Json` to version `9.0.2`. - Added a new `` section in `App.config` and renamed settings to include the "Is" prefix. - Introduced `CreateHostBuilder` method in `App.xaml.cs` for improved dependency injection. - Refactored `MainWindow.xaml` and `MainWindow.xaml.cs` to enhance UI and settings handling. - Added `Settings.cs` for managing application settings with `CommunityToolkit.Mvvm`. - Updated resource files for localization, including a new "Visibility" string. - Refactored `MainWindowViewModel.cs` to use `ObservableRecipient` for messaging. - Introduced `SettingsViewModel.cs` to manage settings view and commands. - Improved UI layout and bindings in `PageNavigationView.xaml`, `SettingsView.xaml`, and `ToolBarView.xaml`. --- Directory.Build.props | 2 +- Directory.Packages.props | 6 +- SketchNow/App.config | 10 +- SketchNow/App.xaml.cs | 15 +- SketchNow/{Views => }/MainWindow.xaml | 30 +-- SketchNow/{Views => }/MainWindow.xaml.cs | 15 +- SketchNow/Models/CustomCursors.cs | 2 +- SketchNow/Models/Settings.cs | 48 +++++ SketchNow/Properties/Resource.Designer.cs | 9 + SketchNow/Properties/Resource.resx | 3 + SketchNow/Properties/Resource.zh-CN.resx | 9 +- SketchNow/Properties/Settings.Designer.cs | 44 ++++- SketchNow/Properties/Settings.settings | 12 +- SketchNow/SketchNow.csproj | 9 +- SketchNow/ViewModels/MainWindowViewModel.cs | 170 +++++------------ SketchNow/ViewModels/SettingsViewModel.cs | 119 ++++++++++++ SketchNow/Views/PageNavigationView.xaml | 1 + SketchNow/Views/SettingsView.xaml | 192 +++++++++++--------- SketchNow/Views/SettingsView.xaml.cs | 2 +- SketchNow/Views/ToolBarView.xaml | 95 +++++----- 20 files changed, 482 insertions(+), 311 deletions(-) rename SketchNow/{Views => }/MainWindow.xaml (84%) rename SketchNow/{Views => }/MainWindow.xaml.cs (51%) create mode 100644 SketchNow/Models/Settings.cs create mode 100644 SketchNow/ViewModels/SettingsViewModel.cs diff --git a/Directory.Build.props b/Directory.Build.props index 6a38982..5858395 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -11,7 +11,7 @@ See: https://learn.microsoft.com/visualstudio/msbuild/customize-your-build enable enable - 12 + preview true