mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 12:15:00 +00:00
refactor<*>: rewrite all codes...
This commit is contained in:
parent
89ff8aa744
commit
30ab8ae954
342 changed files with 17208 additions and 19633 deletions
40
src/Views/Popups/DeleteBranch.xaml.cs
Normal file
40
src/Views/Popups/DeleteBranch.xaml.cs
Normal 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;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue