mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-24 02:40:24 +08:00
feature: add a button to switch tag sort method (creatordate/name asc/name des) (#865)
This commit is contained in:
@@ -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))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user