Example #1
0
        public void Deactivate()
        {
            //the Deactivate method is called by Inventor when the AddIn is unloaded
            //the AddIn will be unloaded either manually by the user or
            //when the Inventor session is terminated

            try
            {
                m_userInterfaceEvents.OnResetCommandBars  -= UserInterfaceEventsSink_OnResetCommandBarsEventDelegate;
                m_userInterfaceEvents.OnResetEnvironments -= UserInterfaceEventsSink_OnResetEnvironmentsEventDelegate;

                UserInterfaceEventsSink_OnResetCommandBarsEventDelegate  = null;
                UserInterfaceEventsSink_OnResetEnvironmentsEventDelegate = null;
                m_userInterfaceEvents = null;
                if (m_partSketchSlotRibbonPanel != null)
                {
                    m_partSketchSlotRibbonPanel.Delete();
                }

                //release inventor Application object
                Marshal.ReleaseComObject(m_inventorApplication);
                m_inventorApplication = null;

                GC.WaitForPendingFinalizers();
                GC.Collect();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
        }
Example #2
0
        public void Deactivate()
        {
            // This method is called by Inventor when the AddIn is unloaded.
            // The AddIn will be unloaded either manually by the user or
            // when the Inventor session is terminated

            // TODO: Add ApplicationAddInServer.Deactivate implementation

            // Release objects.
            m_inventorApplication = null;
            model      = null;
            plus16obj  = null;
            plus128obj = null;
            gear16obj  = null;
            gear128obj = null;

            cmdMan   = null;
            ctrlDefs = null;
            cmdCat.Delete();
            cmdCat        = null;
            drawingRibbon = null;
            placeTab      = null;
            applyButton.Delete();
            applyButton = null;
            settingsButton.Delete();
            settingsButton = null;
            panel.Delete();
            panel = null;
            controlApplyBreak.Delete();
            controlApplyBreak = null;
            controlSettingsBreak.Delete();
            controlSettingsBreak = null;

            GC.Collect();
            GC.WaitForPendingFinalizers();
        }