From 0e2da217f14519a6ce183339cf510dff6e94e15c Mon Sep 17 00:00:00 2001 From: Gadfly Date: Fri, 12 Apr 2024 01:27:19 +0800 Subject: [PATCH] feat: shows the number of files in the current list on unstaged and staged lists --- src/ViewModels/WorkingCopy.cs | 26 ++++++++++++++++++++++++-- src/Views/WorkingCopy.axaml | 20 ++++++++++++++++++-- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/src/ViewModels/WorkingCopy.cs b/src/ViewModels/WorkingCopy.cs index 83cff278..f330c70f 100644 --- a/src/ViewModels/WorkingCopy.cs +++ b/src/ViewModels/WorkingCopy.cs @@ -46,13 +46,25 @@ namespace SourceGit.ViewModels public List Unstaged { get => _unstaged; - private set => SetProperty(ref _unstaged, value); + private set + { + if (SetProperty(ref _unstaged, value)) + { + OnPropertyChanged(nameof(UnstagedCount)); + } + } } public List Staged { get => _staged; - private set => SetProperty(ref _staged, value); + private set + { + if (SetProperty(ref _staged, value)) + { + OnPropertyChanged(nameof(StagedCount)); + } + } } public int Count @@ -60,6 +72,16 @@ namespace SourceGit.ViewModels get => _count; } + public int UnstagedCount + { + get => _unstaged.Count; + } + + public int StagedCount + { + get => _staged.Count; + } + public Models.Change SelectedUnstagedChange { get => _selectedUnstagedChange; diff --git a/src/Views/WorkingCopy.axaml b/src/Views/WorkingCopy.axaml index dba6bc08..11031c07 100644 --- a/src/Views/WorkingCopy.axaml +++ b/src/Views/WorkingCopy.axaml @@ -22,7 +22,15 @@ - + + + + + +