async Task OnDocumentClosing(DocumentCloseEventArgs args) { try { if (DocumentClosing != null) { foreach (var handler in DocumentClosing.GetInvocationList().Cast <DocumentCloseAsyncEventHandler> ()) { await handler(this, args); if (args.Cancel) { break; } } } } catch (Exception ex) { LoggingService.LogError("Exception before closing documents", ex); } }
Task OnWindowClosing(object sender, DocumentCloseEventArgs args) { return(OnDocumentClosing(args)); }
async Task DontClose(object s, DocumentCloseEventArgs e) { await Task.Delay(100); e.Cancel = true; }