Beispiel #1
0
 public DocView(SwAddin addin, IModelView mv, DocumentEventHandler doc)
 {
     userAddin = addin;
     mView     = (ModelView)mv;
     iSwApp    = (ISldWorks)userAddin.SwApp;
     parent    = doc;
 }
Beispiel #2
0
        public bool AttachModelDocEventHandler(ModelDoc2 modDoc)
        {
            if (modDoc == null)
            {
                return(false);
            }

            DocumentEventHandler docHandler = null;

            if (!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();
                openDocs.Add(modDoc, docHandler);
            }
            return(true);
        }