/// <summary> /// Shows the dialog. /// </summary> /// <param name="calledShowMethod">The called show method.</param> /// <param name="owner">The owner.</param> /// <returns></returns> private DialogResult ShowDialog(CalledShowMethod calledShowMethod, IWin32Window owner) { if (!DesignMode) { DialogResult result = DialogResult.None; if (UserCanOpenForm) { result = ShowDialogForm(calledShowMethod, owner); UserIsAllowed?.Invoke(this, new EventArgs()); } else { if (UserIsDenied != null) { result = ShowDialogForm(calledShowMethod, owner); UserIsDenied(this, new EventArgs()); } else if (IsMainWindow) { Application.Exit(); } } return(result); } else { return(ShowDialogForm(calledShowMethod, owner)); } }
/// <summary> /// Shows the specified called show method. /// </summary> /// <param name="calledShowMethod">The called show method.</param> /// <param name="owner">The owner or null otherwise.</param> private void Show(CalledShowMethod calledShowMethod, IWin32Window owner) { if (!DesignMode) { if (UserCanOpenForm) { ShowForm(calledShowMethod, owner); UserIsAllowed?.Invoke(this, new EventArgs()); } else { if (UserIsDenied != null) { ShowForm(calledShowMethod, owner); UserIsDenied(this, new EventArgs()); } else if (this.IsMainWindow) { Application.Exit(); } } } else { ShowForm(calledShowMethod, owner); } }