Пример #1
0
        /// <summary>
        /// Raises the Closing event with a deferral to wait the event handlers to complete the execution.
        /// </summary>
        /// <returns></returns>
        protected virtual Task OnClosingAsync()
        {
            if (!_closingInvoked)
            {
                _closingInvoked = true;

                var e = new DeferralEventArgs();
                Closing.RaiseEvent(this, e);
                return(e.WaitForDeferralsAsync());
            }

            return(Task.FromResult <object>(null));
        }