private IDocument GetOrCreateDocument(ITextDocument textDocument, bool observe) { var factory = GetDocumentFactory(textDocument); if (factory == null) { return(null); } var document = CreateDocument(textDocument, factory, observe); // CreateDocument can return null if document does not belong to RadAsmSyntax if (document != null) { DocumentCreated?.Invoke(document); } return(document); }
private void AttachDocument(IModelDoc2 model) { if (!m_Documents.ContainsKey(model)) { SwDocument doc = null; switch (model) { case IPartDoc part: doc = new SwPart(part, m_App, m_Logger); break; case IAssemblyDoc assm: doc = new SwAssembly(assm, m_App, m_Logger); break; case IDrawingDoc drw: doc = new SwDrawing(drw, m_App, m_Logger); break; default: throw new NotSupportedException(); } doc.Destroyed += OnDocumentDestroyed; m_Documents.Add(model, doc); DocumentCreated?.Invoke(doc); } else { m_Logger.Log($"Conflict. {model.GetTitle()} already registered"); Debug.Assert(false, "Document was not unregistered"); } }
protected internal void DocummentAdded(Document doc) { DocumentCreated?.Invoke(this, new DocumentEventArgs(doc)); }
public void Apply(DocumentCreated @event) { AggregateDataStructure = @event.Document; }
private void Apply(DocumentCreated @event) { this.accessionNumber = new AccessionNumber(@event.AccessionNumber); }