private void Window_btnBrowseClicked(object sender, EventArgs e) { // User selects the path to the file PathDialog pathDialog = new PathDialog(); pathDialog.OnPathChanged += PathDialog_OnPathChanged; pathDialog.OpenPathDialog(); }
public bool GetPath(string name) { PathDialog dialog = _dictionary[name]; if (dialog.Cache && !string.IsNullOrEmpty(dialog.Value)) { Path = dialog.Value; return(true); } if (dialog.IsFolder) { FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog { Description = dialog.Description, SelectedPath = ConfigurationManager.AppSettings[dialog.DefaultPathName] }; if (folderBrowserDialog.ShowDialog() == DialogResult.OK) { dialog.Value = folderBrowserDialog.SelectedPath; Path = dialog.Value; return(true); } } else { if (dialog.OpenDialog) { OpenFileDialog openFileDialog = new OpenFileDialog() { InitialDirectory = ConfigurationManager.AppSettings[dialog.DefaultPathName], Filter = dialog.Filter, Multiselect = false }; if (openFileDialog.ShowDialog() == DialogResult.OK) { dialog.Value = openFileDialog.FileName; Path = dialog.Value; return(true); } } else { SaveFileDialog openFileDialog = new SaveFileDialog() { InitialDirectory = ConfigurationManager.AppSettings[dialog.DefaultPathName], Filter = dialog.Filter }; if (openFileDialog.ShowDialog() == DialogResult.OK) { dialog.Value = openFileDialog.FileName; Path = dialog.Value; return(true); } } } return(false); }
private void btnEditDefaultPath_Click(object sender, EventArgs e) { var path = _lu.DefaultPath ?? _sym.CreatePathGraphics(); using (var diag = new PathDialog(this, _sym, path)) { diag.ShowDialog(); _lu.DefaultPath = path; txtDefaultPath.Text = _lu.DefaultPath.Geometry; } }
private void PathBox_Click(object sender, EventArgs e) { if (PathDialog.ShowDialog() == DialogResult.OK) { Directory = PathDialog.SelectedPath; PathBox.Text = Directory; FindButton.Enabled = true; } else { FindButton.Enabled = false; } }
public DiskPath Add(string name, PathDialog path) { _dictionary.Add(name, path); return(this); }