protected void OnDocumentClosed(DocumentId documentId) { this.CheckDocumentIsOpen(documentId); using (_serializationLock.DisposableWait()) { // forget any open document info ForgetAnyOpenDocumentInfo(documentId); var oldDocuments = this.CurrentDocuments; var oldDocument = oldDocuments.GetDocument(documentId); this.OnDocumentClosing(documentId); // TODO: If document is closed, but is still #include'd by another document, keep it around. var newDocuments = oldDocuments.RemoveDocument(documentId); newDocuments = this.SetCurrentDocuments(newDocuments); var newDoc = newDocuments.GetDocument(documentId); this.OnDocumentTextChanged(newDoc); DocumentClosed?.Invoke(this, new DocumentEventArgs(oldDocument)); } }
/// <summary> /// Closes the document</summary> /// <param name="document">Document to close</param> /// <returns>True iff close was not cancelled by user</returns> public virtual bool Close(IDocument document) { if (document == null) { return(true); } var args = new DocumentClosingEventArgs(document); DocumentClosing.Raise(this, args); bool closeConfirmed = args.Cancel == false && ConfirmClose(document); if (closeConfirmed) { IDocumentClient client = GetClient(document); OnDocumentClosing(document); client.Close(document); DocumentRegistry.Remove(document); m_untitledDocuments.Remove(document); // in case it was untitled m_newDocumentPaths.Remove(document.Uri.LocalPath); // probably not necessary, but seems like a good idea to clean-up OnDocumentClosed(document); DocumentClosed.Raise(this, new DocumentEventArgs(document, DocumentEventType.Closed)); } return(closeConfirmed); }
void OnDocumentClosed(Document doc) { try { var e = new DocumentEventArgs(doc); DocumentClosed?.Invoke(this, e); } catch (Exception ex) { LoggingService.LogError("Exception while closing documents", ex); } }
private void _HandleTextDocumentClosed(object sender, DidCloseTextDocumentParams e) { WorkspaceDocument document = _documents.Where(x => x.Uri.Equals(e.TextDocument.Uri)).FirstOrDefault(); if (document != null) { _documents.Remove(document); DocumentClosed?.Invoke(this, document); } }
private void WorkspaceHostDocumentClosed(DocumentId documentId) { if (documentId == DocumentId) { Dispatcher.Invoke(() => { DocumentClosed?.Invoke(this, EventArgs.Empty); // Document is closing, we assume we have been asked before to save ServiceProvider.Get <IEditorDialogService>().AssetEditorsManager.CloseAssetEditorWindow(Asset, false); }); } }
protected virtual void OnDocumentClosed(DocumentClosedEventArgs e) { DocumentClosed?.Invoke(this, e); }
void OnDocumentClosed(Document doc) { var e = new DocumentEventArgs(doc); DocumentClosed?.SafeInvoke(this, e); }
/// <summary> /// Invokes handlers of the <see cref="DocumentClosed"/> event. /// </summary> /// <param name="document">The closed document.</param> protected void NotifyDocumentClosed(IDocument document) { DocumentClosed?.Invoke(this, new DocumentWindowEventArgs(document)); }
/// <summary> /// Event raised when Revit Document is closed. We need to make sure that task window is also closed. /// </summary> /// <param name="msg">Message object.</param> private void OnDocumentClosed(DocumentClosed msg) { Win?.Close(); }
/// <summary> /// Handler for an event of Revit Document getting closed. It's best to close the /// </summary> /// <param name="obj"></param> private void OnDocumentClosed(DocumentClosed obj) { Win?.Close(); }