Пример #1
0
        /// <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);
        }
Пример #2
0
        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);
        }
Пример #3
0
 /// <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);
 }