/// <summary> /// Initializes a new instance of the <see cref="FolderBrowserDialogWrapper"/> class. /// </summary> /// <param name="settings">The settings for the folder browser dialog.</param> public CustomFolderBrowserDialog(FolderBrowserDialogSettings settings) { this.settings = settings ?? throw new ArgumentNullException(nameof(settings)); folderBrowserDialog = new VistaFolderBrowserDialog { Description = settings.Description, SelectedPath = settings.SelectedPath, ShowNewFolderButton = settings.ShowNewFolderButton }; }
private void BrowseFolder() { var settings = new FolderBrowserDialogSettings { Description = "This is a description" }; bool?success = dialogService.ShowFolderBrowserDialog(this, settings); if (success == true) { Path = settings.SelectedPath; } }
public Task <bool> ShowFolderBrowserDialog(FolderBrowserDialogSettings settings, Action <bool, FolderDialogResult> afterHideCallback) { var dialog = new System.Windows.Forms.FolderBrowserDialog { SelectedPath = settings.SelectedPath, ShowNewFolderButton = settings.ShowNewFolderButton, Description = settings.Description }; var result = dialog.ShowDialog(/* TODO: Get Handle */); var confirmed = result == System.Windows.Forms.DialogResult.OK; return(Task.Run(() => { afterHideCallback(confirmed, new FolderDialogResult(dialog.SelectedPath)); return confirmed; })); }
private void BrowseFolder() { var settings = new FolderBrowserDialogSettings { Description = "Select folder with images", SelectedPath = IOPath.GetDirectoryName(Assembly.GetExecutingAssembly().Location) }; bool?success = dialogService.ShowFolderBrowserDialog(this, settings); if (success == true) { Path = settings.SelectedPath; } }
/// <summary> /// Shows the folder browser dialog. /// </summary> /// <param name="ownerViewModel"> /// A view model that represents the owner window of the dialog. /// </param> /// <param name="settings">The settings for the folder browser dialog.</param> /// <returns> /// If the user clicks the OK button of the dialog that is displayed, true is returned; /// otherwise false. /// </returns> /// <exception cref="ViewNotRegisteredException"> /// No view is registered with specified owner view model as data context. /// </exception> public bool?ShowFolderBrowserDialog( INotifyPropertyChanged ownerViewModel, FolderBrowserDialogSettings settings) { if (ownerViewModel == null) { throw new ArgumentNullException(nameof(ownerViewModel)); } if (settings == null) { throw new ArgumentNullException(nameof(settings)); } Logger.Write($"Description: {settings.Description}"); return(frameworkDialogFactory .CreateFolderBrowserDialog(settings) .ShowDialog(FindOwnerWindow(ownerViewModel))); }
/// <summary> /// Shows the <see cref="FolderBrowserDialog"/>. /// </summary> /// <param name="ownerViewModel"> /// A view model that represents the owner window of the dialog. /// </param> /// <param name="settings">The settings for the folder browser dialog.</param> /// <returns> /// If the user clicks the OK button of the dialog that is displayed, true is returned; /// otherwise false. /// </returns> public bool?ShowFolderBrowserDialog( INotifyPropertyChanged ownerViewModel, FolderBrowserDialogSettings settings) { if (ownerViewModel == null) { throw new ArgumentNullException("ownerViewModel"); } if (settings == null) { throw new ArgumentNullException("settings"); } using (var dialog = new FolderBrowserDialogWrapper(settings)) { DialogResult result = dialog.ShowDialog(new WindowWrapper(FindOwnerWindow(ownerViewModel))); return(result == DialogResult.OK); } }
private Task SaveLocalMultipleDocumentsAsync(List <DocumentDescription> selectedDocuments) { var settings = new FolderBrowserDialogSettings { ShowNewFolderButton = true, Description = "Select output folder...", SelectedPath = Settings.Default.GetExportFolder() }; return(_dialogService.ShowFolderBrowserDialog(settings, async(confirm, result) => { if (confirm) { try { IsRunning = true; // Save path for future use Settings.Default.ExportFolder = result.Path; Settings.Default.Save(); var tasks = selectedDocuments.Select(doc => _dbService.GetDocumentAsync(Connection, doc)); await Task.WhenAll(tasks).ConfigureAwait(false); foreach (var item in tasks) { var document = item.Result; File.WriteAllText(Path.Combine(result.Path, $"{document.Resource.Id}.json"), document.Resource.ToString()); } } catch (Exception ex) { await _dialogService.ShowError(ex, "Error", null, null).ConfigureAwait(false); } finally { IsRunning = false; } } })); }
/// <summary> /// Shows the <see cref="FolderBrowserDialog"/>. /// </summary> /// <param name="ownerViewModel"> /// A view model that represents the owner window of the dialog. /// </param> /// <param name="settings">The settings for the folder browser dialog.</param> /// <returns> /// If the user clicks the OK button of the dialog that is displayed, true is returned; /// otherwise false. /// </returns> /// <exception cref="ViewNotRegisteredException"> /// No view is registered with specified owner view model as data context. /// </exception> public bool?ShowFolderBrowserDialog( INotifyPropertyChanged ownerViewModel, FolderBrowserDialogSettings settings) { if (ownerViewModel == null) { throw new ArgumentNullException(nameof(ownerViewModel)); } if (settings == null) { throw new ArgumentNullException(nameof(settings)); } Logger.Write($"Description: {settings.Description}"); using (var dialog = new FolderBrowserDialogWrapper(settings)) { DialogResult result = dialog.ShowDialog(new Win32Window(FindOwnerWindow(ownerViewModel))); return(result == DialogResult.OK); } }
public FolderBrowserComShellDialog(FolderBrowserDialogSettings settings) { this.settings = settings; }
/// <inheritdoc /> public virtual IFrameworkDialog CreateFolderBrowserDialog(FolderBrowserDialogSettings settings) { return(new FolderBrowserDialogWrapper(settings)); }
public bool?ShowFolderBrowserDialog(INotifyPropertyChanged ownerViewModel, FolderBrowserDialogSettings settings) { throw new NotImplementedException(); }
public override IFrameworkDialog CreateFolderBrowserDialog(FolderBrowserDialogSettings settings) { return new BrowserDialog(settings); }
/// <summary> /// Initializes a new instance of the <see cref="FolderBrowserDialogWrapper"/> class. /// </summary> /// <param name="settings">The settings for the folder browser dialog.</param> public CustomFolderBrowserDialog(FolderBrowserDialogSettings settings) { this.settings = settings ?? throw new ArgumentNullException(nameof(settings)); }