feature<Checkout>: add a status panel for checkout progress

This commit is contained in:
leo 2021-05-26 18:43:28 +08:00
parent 001453d6ff
commit 67f5eed9a0
5 changed files with 64 additions and 24 deletions

View file

@ -0,0 +1,34 @@
using System.Threading.Tasks;
namespace SourceGit.Views.Popups {
/// <summary>
/// 切换分支
/// </summary>
public partial class Checkout : Controls.PopupWidget {
private string repo;
private string branch;
public Checkout(string repo, string branch) {
this.repo = repo;
this.branch = branch;
InitializeComponent();
}
public override string GetTitle() {
return App.Text("BranchCM.Checkout", branch);
}
public override Task<bool> Start() {
UpdateProgress(GetTitle());
return Task.Run(() => {
Models.Watcher.SetEnabled(repo, false);
new Commands.Checkout(repo).Branch(branch, UpdateProgress);
Models.Watcher.SetEnabled(repo, true);
return true;
});
}
}
}