public DocView(SwAddin addin, IModelView mv, DocumentEventHandler doc) { userAddin = addin; mView = (ModelView)mv; iSwApp = (ISldWorks)userAddin.SwApp; parent = doc; }
/// <summary> /// The attach model doc event handler. /// </summary> /// <param name="modDoc"> /// The mod doc. /// </param> /// <returns> /// The <see cref="bool"/>. /// </returns> public bool AttachModelDocEventHandler(ModelDoc2 modDoc) { if (modDoc == null) { return(false); } DocumentEventHandler docHandler = null; if (!this.openDocs.Contains(modDoc)) { switch (modDoc.GetType()) { case (int)swDocumentTypes_e.swDocPART: { docHandler = new PartEventHandler(modDoc, this); break; } case (int)swDocumentTypes_e.swDocASSEMBLY: { docHandler = new AssemblyEventHandler(modDoc, this); break; } case (int)swDocumentTypes_e.swDocDRAWING: { docHandler = new DrawingEventHandler(modDoc, this); break; } default: { return(false); // Unsupported document type } } docHandler.AttachEventHandlers(); this.openDocs.Add(modDoc, docHandler); } return(true); }