示例#1
0
        public bool AttachEventHandlers()
        {
            AttachSwEvents();
            //Listen for events on all currently open docs
            ModelDoc2 modDoc;

            modDoc = (ModelDoc2)iSwApp.GetFirstDocument();
            //iModelDoc = modDoc;
            while (modDoc != null)
            {
                if (!openDocs.Contains(modDoc))
                {
                    AttachModelDocEventHandler(modDoc);
                }
                modDoc = (ModelDoc2)modDoc.GetNext();
            }
            return(true);
        }
示例#2
0
        public void AttachEventsToAllDocuments()
        {
            ModelDoc2 modDoc = (ModelDoc2)iSwApp.GetFirstDocument();

            while (modDoc != null)
            {
                if (!openDocs.Contains(modDoc))
                {
                    AttachModelDocEventHandler(modDoc);
                }
                modDoc = (ModelDoc2)modDoc.GetNext();
            }
        }
示例#3
0
        /// <summary>
        /// Get the first open document from the addin, iterates through the documents and then
        /// if they don't have event handlers, attaches it to them based on the document type
        /// </summary>
        public void AttachEventsToAllDocuments()
        {
            ModelDoc2 ThisDocument = (ModelDoc2)solidworks.GetFirstDocument();

            while (ThisDocument != null)
            {
                if (!documentsEventsRepo.Contains(ThisDocument))
                {
                    AttachEventHandlersToDocument(ThisDocument);
                }
                else if (documentsEventsRepo.Contains(ThisDocument))
                {
                    DocumentEventHandler documentEventHandler = (DocumentEventHandler)documentsEventsRepo[ThisDocument];
                    if (documentEventHandler != null)
                    {
                        documentEventHandler.ConnectModelViews();
                    }
                }
                ThisDocument = (ModelDoc2)ThisDocument.GetNext();
            }
        }
示例#4
0
        public void AttachEventsToAllDocuments()
        {
            ModelDoc2 modDoc = (ModelDoc2)iSwApp.GetFirstDocument();

            while (modDoc != null)
            {
                if (!openDocs.Contains(modDoc))
                {
                    AttachModelDocEventHandler(modDoc);
                }
                else if (openDocs.Contains(modDoc))
                {
                    bool connected = false;
                    DocumentEventHandler docHandler = (DocumentEventHandler)openDocs[modDoc];
                    if (docHandler != null)
                    {
                        connected = docHandler.ConnectModelViews();
                    }
                }

                modDoc = (ModelDoc2)modDoc.GetNext();
            }
        }