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,48 @@
using System.Threading.Tasks;
using System.Windows.Media;
namespace SourceGit.Views.Popups {
/// <summary>
/// 变基操作面板
/// </summary>
public partial class Rebase : Controls.PopupWidget {
private string repo = null;
private string on = null;
public Rebase(string repo, string current, Models.Branch branch) {
this.repo = repo;
this.on = branch.Head;
InitializeComponent();
txtCurrent.Text = current;
txtOn.Text = !string.IsNullOrEmpty(branch.Remote) ? $"{branch.Remote}/{branch.Name}" : branch.Name;
iconBased.Data = FindResource("Icon.Branch") as Geometry;
}
public Rebase(string repo, string current, Models.Commit commit) {
this.repo = repo;
this.on = commit.SHA;
InitializeComponent();
txtCurrent.Text = current;
txtOn.Text = $"{commit.ShortSHA} {commit.Subject}";
iconBased.Data = FindResource("Icon.Branch") as Geometry;
}
public override string GetTitle() {
return App.Text("Rebase");
}
public override Task<bool> Start() {
var autoStash = chkAutoStash.IsChecked == true;
return Task.Run(() => {
Models.Watcher.SetEnabled(repo, false);
new Commands.Rebase(repo, on, autoStash).Exec();
Models.Watcher.SetEnabled(repo, true);
return true;
});
}
}
}