mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-11-01 13:13:21 -07:00
36 lines
988 B
C#
36 lines
988 B
C#
|
using System.Threading.Tasks;
|
||
|
|
||
|
namespace SourceGit.Views.Popups {
|
||
|
/// <summary>
|
||
|
/// 撤销面板
|
||
|
/// </summary>
|
||
|
public partial class Revert : Controls.PopupWidget {
|
||
|
private string repo = null;
|
||
|
private string commit = null;
|
||
|
|
||
|
public Revert(string repo, Models.Commit commit) {
|
||
|
this.repo = repo;
|
||
|
this.commit = commit.SHA;
|
||
|
|
||
|
InitializeComponent();
|
||
|
|
||
|
txtCommit.Text = $"{commit.ShortSHA} {commit.Subject}";
|
||
|
}
|
||
|
|
||
|
public override string GetTitle() {
|
||
|
return App.Text("Revert");
|
||
|
}
|
||
|
|
||
|
public override Task<bool> Start() {
|
||
|
var commitChanges = chkCommit.IsChecked == true;
|
||
|
|
||
|
return Task.Run(() => {
|
||
|
Models.Watcher.SetEnabled(repo, false);
|
||
|
new Commands.Revert(repo, commit, commitChanges).Exec();
|
||
|
Models.Watcher.SetEnabled(repo, true);
|
||
|
return true;
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
}
|