From e31a304cacfd454489832cd6cf3a787c27330e90 Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 18 Oct 2022 15:55:39 +0800 Subject: [PATCH] feature: supports to sort repositories by bookmark color --- src/Models/Preference.cs | 1 + src/Resources/Locales/en_US.xaml | 1 + src/Resources/Locales/zh_CN.xaml | 1 + src/Views/Widgets/Welcome.xaml.cs | 6 +++++- 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Models/Preference.cs b/src/Models/Preference.cs index 4907796c..36dd599d 100644 --- a/src/Models/Preference.cs +++ b/src/Models/Preference.cs @@ -25,6 +25,7 @@ namespace SourceGit.Models { ByNameASC, ByNameDESC, ByRecentlyOpened, + ByBookmark, } /// diff --git a/src/Resources/Locales/en_US.xaml b/src/Resources/Locales/en_US.xaml index 16d81cf0..d3c86338 100644 --- a/src/Resources/Locales/en_US.xaml +++ b/src/Resources/Locales/en_US.xaml @@ -505,6 +505,7 @@ By Name By Name Inversed By Recently Opened + By Bookmark Color Git has NOT been configured. Please to go [Preference] and configure it first. Path[{0}] not exists! diff --git a/src/Resources/Locales/zh_CN.xaml b/src/Resources/Locales/zh_CN.xaml index fe03f456..8ef1cdf2 100644 --- a/src/Resources/Locales/zh_CN.xaml +++ b/src/Resources/Locales/zh_CN.xaml @@ -504,6 +504,7 @@ 按名称正序 按名称倒序 按最近访问 + 按书签颜色 GIT尚未配置。请打开【偏好设置】配置GIT路径。 路径({0})不存在或不可读取! diff --git a/src/Views/Widgets/Welcome.xaml.cs b/src/Views/Widgets/Welcome.xaml.cs index d15d2039..983b8f6b 100644 --- a/src/Views/Widgets/Welcome.xaml.cs +++ b/src/Views/Widgets/Welcome.xaml.cs @@ -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;