/// <summary> /// Handles the <see cref="Modal"/> closing event. /// </summary> /// <param name="eventArgs">Provides the data for the modal closing event.</param> protected virtual Task OnModalClosing(ModalClosingEventArgs eventArgs) { eventArgs.Cancel = BackgroundCancel && (eventArgs.CloseReason == CloseReason.EscapeClosing || eventArgs.CloseReason == CloseReason.FocusLostClosing); return(Task.CompletedTask); }
private bool IsSafeToClose() { var safeToClose = true; var handler = Closing; if (handler != null) { var args = new ModalClosingEventArgs(false, closeReason); foreach (Action <ModalClosingEventArgs> subHandler in handler?.GetInvocationList()) { subHandler(args); if (args.Cancel) { safeToClose = false; } } } return(safeToClose); }
/// <summary> /// Handles the <see cref="Modal"/> closing event. /// </summary> /// <param name="eventArgs">Provides the data for the modal closing event.</param> protected virtual void OnModalClosing(ModalClosingEventArgs eventArgs) { eventArgs.Cancel = BackgroundCancel && (eventArgs.CloseReason == CloseReason.EscapeClosing || eventArgs.CloseReason == CloseReason.FocusLostClosing); }