mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-11-01 13:13:21 -07:00
35 lines
899 B
C#
35 lines
899 B
C#
|
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;
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
}
|