-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(settings): update settings management and UI enhancements
- 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 `<connectionStrings />` 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`.
- Loading branch information
Showing
20 changed files
with
482 additions
and
311 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 11 additions & 4 deletions
15
SketchNow/Views/MainWindow.xaml.cs → SketchNow/MainWindow.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System.Windows; | ||
using System.Windows.Media; | ||
|
||
using CommunityToolkit.Mvvm.ComponentModel; | ||
using CommunityToolkit.Mvvm.Input; | ||
|
||
namespace SketchNow.Models; | ||
|
||
public partial class Settings : ObservableObject | ||
{ | ||
[ObservableProperty] | ||
private bool _isFitToCurve; | ||
|
||
[ObservableProperty] | ||
private bool _isIgnorePressure; | ||
|
||
[ObservableProperty] | ||
private bool _isEraseByStroke; | ||
|
||
[ObservableProperty] | ||
private Brush _selectedBackground; | ||
|
||
public Settings() | ||
{ | ||
IsFitToCurve = Properties.Settings.Default.IsFitToCurve; | ||
IsIgnorePressure = Properties.Settings.Default.IsIgnorePressure; | ||
IsEraseByStroke = Properties.Settings.Default.IsEraseByStroke; | ||
SelectedBackground = Properties.Settings.Default.SelectedBackground; | ||
} | ||
|
||
public Settings(bool isFitToCurve, bool isIgnorePressure, bool isEraseByStroke, Brush selectedBackground) | ||
{ | ||
IsFitToCurve = isFitToCurve; | ||
IsIgnorePressure = isIgnorePressure; | ||
IsEraseByStroke = isEraseByStroke; | ||
SelectedBackground = selectedBackground; | ||
} | ||
|
||
[RelayCommand] | ||
private void SaveSettings() | ||
{ | ||
Properties.Settings.Default.IsFitToCurve = IsFitToCurve; | ||
Properties.Settings.Default.IsIgnorePressure = IsIgnorePressure; | ||
Properties.Settings.Default.IsEraseByStroke = IsEraseByStroke; | ||
Properties.Settings.Default.SelectedBackground = SelectedBackground; | ||
Properties.Settings.Default.Save(); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.