mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 12:15:00 +00:00
feature: add a button to switch tag sort method (creatordate/name asc/name des) (#865)
This commit is contained in:
parent
84721a7258
commit
08a128cd87
9 changed files with 112 additions and 6 deletions
|
@ -141,6 +141,20 @@ namespace SourceGit.ViewModels
|
|||
}
|
||||
}
|
||||
|
||||
public Models.TagSortMode TagSortMode
|
||||
{
|
||||
get => _settings.TagSortMode;
|
||||
set
|
||||
{
|
||||
if (value != _settings.TagSortMode)
|
||||
{
|
||||
_settings.TagSortMode = value;
|
||||
OnPropertyChanged();
|
||||
VisibleTags = BuildVisibleTags();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string Filter
|
||||
{
|
||||
get => _filter;
|
||||
|
@ -2131,6 +2145,19 @@ namespace SourceGit.ViewModels
|
|||
|
||||
private List<Models.Tag> BuildVisibleTags()
|
||||
{
|
||||
switch (_settings.TagSortMode)
|
||||
{
|
||||
case Models.TagSortMode.CreatorDate:
|
||||
_tags.Sort((l, r) => r.CreatorDate.CompareTo(l.CreatorDate));
|
||||
break;
|
||||
case Models.TagSortMode.NameInAscending:
|
||||
_tags.Sort((l, r) => Models.NumericSort.Compare(l.Name, r.Name));
|
||||
break;
|
||||
default:
|
||||
_tags.Sort((l, r) => Models.NumericSort.Compare(r.Name, l.Name));
|
||||
break;
|
||||
}
|
||||
|
||||
var visible = new List<Models.Tag>();
|
||||
if (string.IsNullOrEmpty(_filter))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue