feature<Welcome>: supports to sort repositories by bookmark color

This commit is contained in:
leo 2022-10-18 15:55:39 +08:00
parent c6f99287e7
commit e31a304cac
4 changed files with 8 additions and 1 deletions

View file

@ -25,6 +25,7 @@ namespace SourceGit.Models {
ByNameASC,
ByNameDESC,
ByRecentlyOpened,
ByBookmark,
}
/// <summary>

View file

@ -505,6 +505,7 @@
<sys:String x:Key="Text.Sort.NameAsc">By Name</sys:String>
<sys:String x:Key="Text.Sort.NameDesc">By Name Inversed</sys:String>
<sys:String x:Key="Text.Sort.RecentlyOpened">By Recently Opened</sys:String>
<sys:String x:Key="Text.Sort.Bookmark">By Bookmark Color</sys:String>
<sys:String x:Key="Text.NotConfigured">Git has NOT been configured. Please to go [Preference] and configure it first.</sys:String>
<sys:String x:Key="Text.PathNotFound">Path[{0}] not exists!</sys:String>

View file

@ -504,6 +504,7 @@
<sys:String x:Key="Text.Sort.NameAsc">按名称正序</sys:String>
<sys:String x:Key="Text.Sort.NameDesc">按名称倒序</sys:String>
<sys:String x:Key="Text.Sort.RecentlyOpened">按最近访问</sys:String>
<sys:String x:Key="Text.Sort.Bookmark">按书签颜色</sys:String>
<sys:String x:Key="Text.NotConfigured">GIT尚未配置。请打开【偏好设置】配置GIT路径。</sys:String>
<sys:String x:Key="Text.PathNotFound">路径({0})不存在或不可读取!</sys:String>

View file

@ -92,6 +92,7 @@ namespace SourceGit.Views.Widgets {
FillSortMenu(menu, Models.Preference.SortMethod.ByNameASC, "Sort.NameAsc");
FillSortMenu(menu, Models.Preference.SortMethod.ByNameDESC, "Sort.NameDesc");
FillSortMenu(menu, Models.Preference.SortMethod.ByRecentlyOpened, "Sort.RecentlyOpened");
FillSortMenu(menu, Models.Preference.SortMethod.ByBookmark, "Sort.Bookmark");
menu.IsOpen = true;
e.Handled = true;
@ -195,9 +196,12 @@ namespace SourceGit.Views.Widgets {
case Models.Preference.SortMethod.ByNameDESC:
visibles.Sort((l, r) => r.Name.CompareTo(l.Name));
break;
default:
case Models.Preference.SortMethod.ByRecentlyOpened:
visibles.Sort((l, r) => r.LastOpenTime.CompareTo(l.LastOpenTime));
break;
default:
visibles.Sort((l, r) => l.Bookmark.CompareTo(r.Bookmark));
break;
}
repoList.ItemsSource = visibles;