/// <summary> /// Opens a Dialog in which the User can select a File inside a Directory. /// </summary> /// <param name="dir">Directory to show.</param> /// <param name="fileExtension">File-Extension to search from.</param> /// <param name="title">Title of the Dialog.</param> /// <returns>Selected File. Null if empty.</returns> public string OpenDirDialog(string dir, string fileExtension, string title) { var window = new DirectorySelectorDialog(dir, fileExtension, title); if (window.ShowDialog() == true) { return(window.SelectedFile); } return(null); }
private void Output_btn_Click(object sender, EventArgs e) { var result = DirectorySelectorDialog.ShowDialog(); if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(DirectorySelectorDialog.SelectedPath)) { SaveDirectoryTextBox.Text = SaveDirectory = DirectorySelectorDialog.SelectedPath; DirectorySelectorDialog.SelectedPath = null; return; } if (string.IsNullOrWhiteSpace(SaveDirectory)) { SaveDirectoryTextBox.Text = "No Directory Selected"; } }