From 687b58576d6d91c19ca669955f9072e77fb850e3 Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 19 Sep 2024 09:21:04 +0800 Subject: [PATCH] code_style: use readonly property instead of responsive property for `Workspace.Brush` --- src/ViewModels/Workspace.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/ViewModels/Workspace.cs b/src/ViewModels/Workspace.cs index c1c586bc..949cca82 100644 --- a/src/ViewModels/Workspace.cs +++ b/src/ViewModels/Workspace.cs @@ -1,8 +1,5 @@ using System.Collections.Generic; -using System.Text.Json.Serialization; - using Avalonia.Media; - using CommunityToolkit.Mvvm.ComponentModel; namespace SourceGit.ViewModels @@ -21,7 +18,7 @@ namespace SourceGit.ViewModels set { if (SetProperty(ref _color, value)) - Brush = new SolidColorBrush(value); + OnPropertyChanged(nameof(Brush)); } } @@ -49,11 +46,9 @@ namespace SourceGit.ViewModels set => SetProperty(ref _restoreOnStartup, value); } - [JsonIgnore] public IBrush Brush { - get => _brush; - private set => SetProperty(ref _brush, value); + get => new SolidColorBrush(_color); } public void AddRepository(string repo) @@ -66,6 +61,5 @@ namespace SourceGit.ViewModels private uint _color = 4278221015; private bool _isActive = false; private bool _restoreOnStartup = true; - private IBrush _brush = new SolidColorBrush(4278221015); } }