public void InputFileOpenDialogClicked(Object sender, EventArgs e) { if (openFileDialog == null) { openFileDialog = new OpenFileDialog(); openFileDialog.RestoreDirectory = true; if (String.IsNullOrEmpty(name)) { openFileDialog.Title = "Select Input File"; } else { openFileDialog.Title = "Select " + name; } } { String dir = ParameterGuiUtil.FindDirectory(text.Text); if (dir != null) { openFileDialog.InitialDirectory = dir; } } if (openFileDialog.ShowDialog() == DialogResult.OK) { text.Text = openFileDialog.FileName; } }
public void SelectDirectoryDialogClicked(Object sender, EventArgs e) { if (openFileDialog == null) { openFileDialog = new OpenFileDialog(); openFileDialog.RestoreDirectory = true; if (String.IsNullOrEmpty(name)) { openFileDialog.Title = "Select Output Directory"; } else { openFileDialog.Title = "Select " + name; } openFileDialog.ValidateNames = false; openFileDialog.CheckFileExists = false; openFileDialog.CheckPathExists = false; } { String dir = ParameterGuiUtil.FindDirectory(text.Text); if (dir != null) { openFileDialog.InitialDirectory = dir; } } openFileDialog.FileName = SelectFolder; if (openFileDialog.ShowDialog() == DialogResult.OK) { String textString = openFileDialog.FileName; if (textString.EndsWith(SelectFolder)) { text.Text = textString.Remove(textString.Length - 1 - SelectFolder.Length); } else { text.Text = textString; } } }