mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-23 21:24:59 +00:00
refactor: add a popup panel to show submodule updating status
This commit is contained in:
parent
069c78f213
commit
d0edc09b2e
8 changed files with 71 additions and 9 deletions
|
@ -769,6 +769,12 @@ namespace SourceGit.ViewModels
|
|||
PopupHost.ShowPopup(new AddSubmodule(this));
|
||||
}
|
||||
|
||||
public void UpdateSubmodules()
|
||||
{
|
||||
if (PopupHost.CanCreatePopup())
|
||||
PopupHost.ShowAndStartPopup(new UpdateSubmodules(this));
|
||||
}
|
||||
|
||||
public ContextMenu CreateContextMenuForGitFlow()
|
||||
{
|
||||
var menu = new ContextMenu();
|
||||
|
|
28
src/ViewModels/UpdateSubmodules.cs
Normal file
28
src/ViewModels/UpdateSubmodules.cs
Normal file
|
@ -0,0 +1,28 @@
|
|||
using System.Threading.Tasks;
|
||||
|
||||
namespace SourceGit.ViewModels
|
||||
{
|
||||
public class UpdateSubmodules : Popup
|
||||
{
|
||||
public UpdateSubmodules(Repository repo)
|
||||
{
|
||||
_repo = repo;
|
||||
View = new Views.UpdateSubmodules() { DataContext = this };
|
||||
}
|
||||
|
||||
public override Task<bool> Sure()
|
||||
{
|
||||
_repo.SetWatcherEnabled(false);
|
||||
ProgressDescription = "Updating submodules ...";
|
||||
|
||||
return Task.Run(() =>
|
||||
{
|
||||
new Commands.Submodule(_repo.FullPath).Update(SetProgressDescription);
|
||||
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
private readonly Repository _repo = null;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue