refactor<*>: rewrite all codes...

This commit is contained in:
leo 2021-04-29 20:05:55 +08:00
parent 89ff8aa744
commit 30ab8ae954
342 changed files with 17208 additions and 19633 deletions

View file

@ -0,0 +1,40 @@
using System.Threading.Tasks;
namespace SourceGit.Views.Popups {
/// <summary>
/// 删除分支确认
/// </summary>
public partial class DeleteBranch : Controls.PopupWidget {
private string repo = null;
private string branch = null;
private string remote = null;
public DeleteBranch(string repo, string branch, string remote = null) {
this.repo = repo;
this.branch = branch;
this.remote = remote;
InitializeComponent();
if (string.IsNullOrEmpty(remote)) txtTarget.Text = branch;
else txtTarget.Text = $"{remote}/{branch}";
}
public override string GetTitle() {
return App.Text("DeleteBranch");
}
public override Task<bool> Start() {
return Task.Run(() => {
Models.Watcher.SetEnabled(repo, false);
if (string.IsNullOrEmpty(remote)) {
new Commands.Branch(repo, branch).Delete();
} else {
new Commands.Push(repo, remote, branch).Exec();
}
Models.Watcher.SetEnabled(repo, true);
return true;
});
}
}
}