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"); } }
public SwPartBodyCollection(SwPart rootDoc) : base(rootDoc) { m_Part = rootDoc; }