From 0e49ad181a0275a754762438f2fd5801b1ad7ee8 Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 21 Mar 2024 11:40:17 +0800 Subject: [PATCH] enhance: remeber tag group and submodule group IsExpanded state. --- src/SourceGit/ViewModels/Repository.cs | 20 ++++++++++++++++++++ src/SourceGit/Views/Repository.axaml | 8 ++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/SourceGit/ViewModels/Repository.cs b/src/SourceGit/ViewModels/Repository.cs index 3c7e5af7..ee684ee3 100644 --- a/src/SourceGit/ViewModels/Repository.cs +++ b/src/SourceGit/ViewModels/Repository.cs @@ -210,6 +210,20 @@ namespace SourceGit.ViewModels set => SetProperty(ref _searchedCommits, value); } + [JsonIgnore] + public bool IsTagGroupExpanded + { + get => _isTagGroupExpanded; + set => SetProperty(ref _isTagGroupExpanded, value); + } + + [JsonIgnore] + public bool IsSubmoduleGroupExpanded + { + get => _isSubmoduleGroupExpanded; + set => SetProperty(ref _isSubmoduleGroupExpanded, value); + } + public void Open() { _watcher = new Models.Watcher(this); @@ -250,6 +264,9 @@ namespace SourceGit.ViewModels _isSearching = false; _searchCommitFilter = string.Empty; + _isTagGroupExpanded = false; + _isSubmoduleGroupExpanded = false; + _remotes.Clear(); _branches.Clear(); _localBranchTrees.Clear(); @@ -1265,6 +1282,9 @@ namespace SourceGit.ViewModels private string _searchCommitFilter = string.Empty; private List _searchedCommits = new List(); + private bool _isTagGroupExpanded = false; + private bool _isSubmoduleGroupExpanded = false; + private List _remotes = new List(); private List _branches = new List(); private List _localBranchTrees = new List(); diff --git a/src/SourceGit/Views/Repository.axaml b/src/SourceGit/Views/Repository.axaml index e10ead2f..419ab893 100644 --- a/src/SourceGit/Views/Repository.axaml +++ b/src/SourceGit/Views/Repository.axaml @@ -241,7 +241,7 @@ - + @@ -265,7 +265,7 @@ HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" LostFocus="OnTagDataGridLostFocus" - IsVisible="{Binding #toggleTags.IsChecked}" + IsVisible="{Binding IsTagGroupExpanded, Mode=OneWay}" SelectionChanged="OnTagDataGridSelectionChanged" ContextRequested="OnTagContextRequested"> @@ -301,7 +301,7 @@ - + @@ -334,7 +334,7 @@ HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" ContextRequested="OnSubmoduleContextRequested" - IsVisible="{Binding #toggleSubmodules.IsChecked}"> + IsVisible="{Binding IsSubmoduleGroupExpanded, Mode=OneWay}">