コード例 #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);
 }