From 9b5e8429b93d7e050e68e8798d4afdfc0fd833c8 Mon Sep 17 00:00:00 2001 From: leo Date: Sun, 28 Apr 2024 10:19:12 +0800 Subject: [PATCH] feature: add hotkey 'F5' to reload/refresh whole repository --- src/Resources/Locales/en_US.axaml | 1 + src/Resources/Locales/zh_CN.axaml | 1 + src/ViewModels/Repository.cs | 27 ++++++++++++++++----------- src/Views/Hotkeys.axaml | 5 ++++- src/Views/Launcher.axaml.cs | 9 +++++++++ 5 files changed, 31 insertions(+), 12 deletions(-) diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 55c997c4..fc2260a8 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -211,6 +211,7 @@ Go to next page Create new page REPOSITORY + Force to reload this repository Stage/Unstage selected changes Toggle commit search Switch to 'Changes' diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index a6fdb67f..ae5a624f 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -211,6 +211,7 @@ 切换到下一个页面 新建页面 仓库页面快捷键 + 重新加载仓库状态 将选中的变更暂存或从暂存列表中移除 打开/关闭历史搜索 显示本地更改 diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index 61afbb6b..4d800a48 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -233,17 +233,7 @@ namespace SourceGit.ViewModels _inProgressContext = null; _hasUnsolvedConflicts = false; - Task.Run(() => - { - RefreshBranches(); - RefreshTags(); - RefreshCommits(); - }); - - Task.Run(RefreshSubmodules); - Task.Run(RefreshWorkingCopyChanges); - Task.Run(RefreshStashes); - Task.Run(RefreshGitFlow); + RefreshAll(); } public void Close() @@ -277,6 +267,21 @@ namespace SourceGit.ViewModels _searchedCommits.Clear(); } + public void RefreshAll() + { + Task.Run(() => + { + RefreshBranches(); + RefreshTags(); + RefreshCommits(); + }); + + Task.Run(RefreshSubmodules); + Task.Run(RefreshWorkingCopyChanges); + Task.Run(RefreshStashes); + Task.Run(RefreshGitFlow); + } + public void OpenInFileManager() { Native.OS.OpenInFileManager(_fullpath); diff --git a/src/Views/Hotkeys.axaml b/src/Views/Hotkeys.axaml index 0a597601..09fa93fb 100644 --- a/src/Views/Hotkeys.axaml +++ b/src/Views/Hotkeys.axaml @@ -87,7 +87,7 @@ FontSize="{Binding Source={x:Static vm:Preference.Instance}, Path=DefaultFontSize, Converter={x:Static c:FontSizeModifyConverters.Increase}}" Margin="0,8"/> - + @@ -102,6 +102,9 @@ + + +