private DlgBox() {} // To remove the constructor from the documentation! /////////////////////////////////////////////////////////////////////// // CommonDialog /// <summary> /// Show a command dialog box at the center of the active window. /// </summary> public static DialogResult ShowDialog(CommonDialog dlg) { CenterWindow centerWindow = new CenterWindow(IntPtr.Zero); DialogResult dlgResult = dlg.ShowDialog(); centerWindow.Dispose(); return dlgResult; }
/// <summary> /// Show a command dialog box at the center of the owner window. /// </summary> public static DialogResult ShowDialog(CommonDialog dlg, IWin32Window owner) { IntPtr handle = (owner == null) ? IntPtr.Zero: owner.Handle; CenterWindow centerWindow = new CenterWindow(handle); DialogResult dlgResult = dlg.ShowDialog(); centerWindow.Dispose(); return dlgResult; }
protected DialogResult ShowDialog(CommonDialog dialog) { if (InvokeRequired) { ShowDialogCallback d = ShowDialog; return (DialogResult)Invoke(d, new Object[] { dialog }); } return dialog.ShowDialog(this); }
private string _ShowFolderDialogOrFileDialogAndGetPath(CommonDialog dialog) { switch (dialog.ShowDialog()) { case DialogResult.OK: return dialog is FolderBrowserDialog ? ((FolderBrowserDialog) dialog).SelectedPath : ((FileDialog) dialog).FileName; case DialogResult.Cancel: return null; } return null; }
/// <summary> /// Runs a common dialog box with the owner defined in this class. /// </summary> /// <param name="dlg">Dialog to show.</param> /// <returns>One of the <see cref="T:System.Windows.Forms.DialogResult"/> values.</returns> /// <exception cref="ArgumentNullException">dlg is null.</exception> protected DialogResult ShowDialog(CommonDialog dlg) { if (dlg == null) throw new ArgumentNullException("dlg"); return dlg.ShowDialog(Owner); }
private DialogResult ShowDialog(CommonDialog commonDialog) { return commonDialog.ShowDialog(); }
public static DialogResult ShowModalDialog(Form parent, CommonDialog dialog) { parent.Enabled = false; DialogResult r = dialog.ShowDialog(); parent.Enabled = true; dialog.Dispose(); return r; }
private DialogResult InternalShowDialog(CommonDialog dialog) { if (dialog == null) throw new ArgumentNullException("dialog"); this.PrepareForDialog(); try { return dialog.ShowDialog(this); } finally { this.DecomissionFromDialog(); } }
public DialogResult ShowDialog(CommonDialog dialog, IWin32Window owner) { return dialog.ShowDialog(owner); }
private void GetPath(CommonDialog dialog, Control textControl) { if (dialog.ShowDialog() == DialogResult.OK) { textControl.Text = openFileDialog.FileName; } }
/// <summary> /// Shows a common dialog. /// </summary> /// <param name="commonDialog">The common dialog to show.</param> /// <returns>The common dialog result.</returns> public DialogResult ShowDialog(CommonDialog commonDialog) { if (commonDialog == null) throw new ArgumentNullException("commonDialog"); return commonDialog.ShowDialog(Owner); }