feature<Welcome>: add sort supports

This commit is contained in:
leo 2022-10-17 10:12:59 +08:00
parent 1beafbc84c
commit 918263130c
10 changed files with 101 additions and 35 deletions

View file

@ -18,6 +18,15 @@ namespace SourceGit.Models {
"preference_v4.json");
private static Preference instance = null;
/// <summary>
/// 起始页仓库列表排序方式
/// </summary>
public enum SortMethod {
ByNameASC,
ByNameDESC,
ByRecentlyOpened,
}
/// <summary>
/// 通用配置
/// </summary>
@ -68,6 +77,11 @@ namespace SourceGit.Models {
/// 上一次检测的时间(用于控制每天仅第一次启动软件时,检测)
/// </summary>
public int LastCheckDay { get; set; } = 0;
/// <summary>
/// 起始页仓库列表排序规则
/// </summary>
public SortMethod SortBy { get; set; } = SortMethod.ByNameASC;
}
/// <summary>

View file

@ -28,6 +28,7 @@ namespace SourceGit.Models {
public string Path { get; set; } = "";
public string GitDir { get; set; } = "";
public int Bookmark { get; set; } = 0;
public long LastOpenTime { get; set; } = 0;
public List<SubTree> SubTrees { get; set; } = new List<SubTree>();
public List<string> Filters { get; set; } = new List<string>();
public List<string> CommitMessages { get; set; } = new List<string>();

View file

@ -56,6 +56,7 @@ namespace SourceGit.Models {
var watcher = new Watcher();
watcher.Start(repo.Path, repo.GitDir);
all.Add(repo.Path, watcher);
repo.LastOpenTime = DateTime.Now.ToFileTime();
Opened?.Invoke(repo);
}