Catel.Windows.DataWindow.OnDataWindowClosing C# (CSharp) Метод

OnDataWindowClosing() приватный Метод

Handles the Closing event of the DataWindow control.
private OnDataWindowClosing ( object sender, CancelEventArgs args ) : void
sender object The source of the event.
args CancelEventArgs The instance containing the event data.
Результат void
        private async void OnDataWindowClosing(object sender, CancelEventArgs args)
        {
            if (!_forceClose && !ClosedByButton)
            {
                var vm = ViewModel;
                if (vm != null && vm.IsClosed)
                {
                    // Being closed from the vm
                    return;
                }

                // CTL-735 always cancel, we will close later once we handled our async result
                args.Cancel = true;

                if (await DiscardChangesAsync())
                {
                    // Now we can close for sure
                    _forceClose = true;

                    // Dispatcher to make sure we are not inside the same loop
#pragma warning disable 4014
                    Dispatcher.BeginInvoke(() => SetDialogResultAndMakeSureWindowGetsClosed(false));
#pragma warning restore 4014
                }
            }
        }