private void OnCloseRequestedDeferralComplete(SystemNavigationCloseRequestedPreviewEventArgs args) { if (!args.Handled) { // Set flag and close the application's window again. HasConfirmedClose = true; NSApplication.SharedApplication.KeyWindow.PerformClose(null); } }
internal void OnCloseRequested() { var eventArgs = new SystemNavigationCloseRequestedPreviewEventArgs(OnCloseRequestedDeferralComplete); CloseRequested?.Invoke(null, eventArgs); eventArgs.EventRaiseCompleted(); if (!eventArgs.IsDeferred) { HasConfirmedClose = !eventArgs.Handled; } }