feature<FolderDialog>: add FolderDialog to remove dependency on System.Windows.Forms

This commit is contained in:
leo 2020-11-23 13:41:13 +08:00
parent 6bf06c87f1
commit e42290eef1
14 changed files with 336 additions and 121 deletions

View file

@ -586,12 +586,10 @@ namespace SourceGit.UI {
var patch = new MenuItem();
patch.Header = "Save As Patch";
patch.Click += (o, e) => {
var dialog = new System.Windows.Forms.FolderBrowserDialog();
dialog.ShowNewFolderButton = true;
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
Repo.RunCommand($"format-patch {commit.SHA} -1 -o \"{dialog.SelectedPath}\"", null);
}
var dialog = new FolderDailog("Save To ...", null);
dialog.Open(saveTo => {
Repo.RunCommand($"format-patch {commit.SHA} -1 -o \"{saveTo}\"", null);
});
};
menu.Items.Add(patch);
menu.Items.Add(new Separator());