/// <summary> /// Called when the button is clicked. /// </summary> /// <param name="e">An <see cref="T:System.EventArgs"/> that contains the event data. </param> protected override void OnClick(EventArgs e) { base.OnClick(e); using (var ofd = new OpenFileDialog()) { ofd.Multiselect = MultiSelect; ofd.Filter = Filter; ofd.InitialDirectory = InitialDirectory; ofd.Title = DialogTitle; if (ofd.ShowDialog() == DialogResult.OK) { var fse = new FileSelectEventArgs(ofd.FileName, ofd.FileNames); OnFileSelect(fse); } } }
private void pacBrowseButton_FileSelect(object sender, FileSelectEventArgs e) { pacPathTextBox.Text = e.FileName; }
/// <summary> /// Called when the user presses OK in the OpenFileDialog. /// </summary> /// <param name="e"></param> protected virtual void OnFileSelect(FileSelectEventArgs e) { EventHandler<FileSelectEventArgs> handler = FileSelect; if (handler != null) handler(this, e); }