protected virtual BrowseResult BrowseFolder(BrowseOptions options) { var result = default(BrowseResult); Windows.Invoke(() => { //TODO: Use only WPF frameworks. using (var dialog = new global::System.Windows.Forms.FolderBrowserDialog()) { dialog.Description = options.Title; if (Directory.Exists(options.Path)) { dialog.SelectedPath = options.Path; } var window = Windows.ActiveWindow; var success = default(bool); switch (dialog.ShowDialog(new Win32Window(window.GetHandle()))) { case global::System.Windows.Forms.DialogResult.OK: success = true; break; } result = new BrowseResult(new[] { dialog.SelectedPath }, success); } //TODO: Bad .Wait(). }).Wait(); return(result); }
internal static string smethod_4(string string_0, string string_1 = "Conversion output folder") { string result = null; using (global::System.Windows.Forms.FolderBrowserDialog folderBrowserDialog = new global::System.Windows.Forms.FolderBrowserDialog()) { folderBrowserDialog.Description = string_1; folderBrowserDialog.ShowNewFolderButton = true; folderBrowserDialog.RootFolder = global::System.Environment.SpecialFolder.MyComputer; folderBrowserDialog.SelectedPath = string_0; if (folderBrowserDialog.ShowDialog() == global::System.Windows.Forms.DialogResult.OK) { result = folderBrowserDialog.SelectedPath; } } return(result); }
protected virtual BrowseResult BrowseFolder(BrowseOptions options) { return(this.WithApartmentState(ApartmentState.STA, () => { //TODO: Use only WPF frameworks. using (var dialog = new global::System.Windows.Forms.FolderBrowserDialog()) { dialog.Description = options.Title; if (Directory.Exists(options.Path)) { dialog.SelectedPath = options.Path; } var window = this.GetActiveWindow(); var success = default(bool); switch (dialog.ShowDialog(new Win32Window(window.GetHandle()))) { case global::System.Windows.Forms.DialogResult.OK: success = true; break; } return new BrowseResult(new[] { dialog.SelectedPath }, success); } })); }