public static DialogResult ShowModalDialog(Form parent, CommonDialog dialog) { parent.Enabled = false; DialogResult r = dialog.ShowDialog(); parent.Enabled = true; dialog.Dispose(); return(r); }
protected void UpdateDialog() { if (_Dialog != null) { _Dialog.Dispose(); } if (_Mode == BrowseMode.OpenFile) { _Dialog = new OpenFileDialog(); } else if (_Mode == BrowseMode.SaveFile) { _Dialog = new SaveFileDialog(); } else if (_Mode == BrowseMode.Directory) { _Dialog = new FolderBrowserDialog(); } }
public void Execute(SupportProcessor processor, UXData data) { if ((processor != null) && (data != null)) { Processor = processor; Data = data; Dialog = GetDialog(); var run = Dialog != null?Dialog.ShowDialog() == DialogResult.OK : true; if (run) { Cursor.Current = Cursors.WaitCursor; try { Process(); } finally { Cursor.Current = Cursors.Default; Dialog?.Dispose(); } } } }