public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)
        {
            // This method is called by Inventor when it loads the addin.
            // The AddInSiteObject provides access to the Inventor Application object.
            // The FirstTime flag indicates if the addin is loaded for the first time.

            // Initialize AddIn members.
            m_inventorApplication = addInSiteObject.Application;

            // TODO: Add ApplicationAddInServer.Activate implementation.
            // e.g. event initialization, command creation etc.

            int largeIconSize = 0;

            if (m_inventorApplication.UserInterfaceManager.InterfaceStyle == InterfaceStyleEnum.kRibbonInterface)
            {
                largeIconSize = 32;
            }
            else
            {
                largeIconSize = 24;
            }

            ControlDefinitions controlDefs = m_inventorApplication.CommandManager.ControlDefinitions;

            stdole.IPictureDisp smallPicture1 = AxHostConverter.ImageToPictureDisp(new Icon(@"Resources\Icon1.ico").ToBitmap());
            stdole.IPictureDisp largePicture1 = AxHostConverter.ImageToPictureDisp(new Icon(@"Resources\Icon1.ico").ToBitmap());
            m_TreeViewBrowser            = controlDefs.AddButtonDefinition("HierarchyPane", "BrowserSample:HierarchyPane", CommandTypesEnum.kNonShapeEditCmdType, m_ClientId, null, null, smallPicture1, largePicture1);
            m_TreeViewBrowser.OnExecute += new ButtonDefinitionSink_OnExecuteEventHandler(m_TreeViewBrowser_OnExecute);



            stdole.IPictureDisp smallPicture2 = AxHostConverter.ImageToPictureDisp(new Icon(@"Resources\Icon2.ico").ToBitmap());
            stdole.IPictureDisp largePicture2 = AxHostConverter.ImageToPictureDisp(new Icon(@"Resources\Icon2.ico").ToBitmap());
            m_ActiveXBrowser            = controlDefs.AddButtonDefinition("ActiveXPane", "BrowserSample:ActiveXPane", CommandTypesEnum.kNonShapeEditCmdType, m_ClientId, null, null, smallPicture2, largePicture2);
            m_ActiveXBrowser.OnExecute += new ButtonDefinitionSink_OnExecuteEventHandler(m_ActiveXBrowser_OnExecute);

            stdole.IPictureDisp smallPicture3 = AxHostConverter.ImageToPictureDisp(new Icon(@"Resources\Icon3.ico").ToBitmap());
            stdole.IPictureDisp largePicture3 = AxHostConverter.ImageToPictureDisp(new Icon(@"Resources\Icon3.ico").ToBitmap());
            m_DoBrowserEvents            = controlDefs.AddButtonDefinition("DoBrowserEvents", "BrowserSample:DoBrowserEvents", CommandTypesEnum.kNonShapeEditCmdType, m_ClientId, null, null, smallPicture3, largePicture3);
            m_DoBrowserEvents.OnExecute += new ButtonDefinitionSink_OnExecuteEventHandler(m_DoBrowserEvents_OnExecute);


            // Get the assembly ribbon.
            Inventor.Ribbon partRibbon = m_inventorApplication.UserInterfaceManager.Ribbons["Part"];
            // Get the "Part" tab.
            Inventor.RibbonTab   partTab   = partRibbon.RibbonTabs[1];
            Inventor.RibbonPanel partPanel = partTab.RibbonPanels[1];
            partPanel.CommandControls.AddButton(m_TreeViewBrowser, true);
            partPanel.CommandControls.AddButton(m_DoBrowserEvents);
            partPanel.CommandControls.AddButton(m_ActiveXBrowser);
        }
        /// <summary>
        /// When [HierarchicalBrowser] button is clicked
        /// </summary>
        /// <param name="Context"></param>
        /// <remarks></remarks>

        private void m_TreeViewBrowser_OnExecute(Inventor.NameValueMap Context)
        {
            Document oDoc = default(Document);

            oDoc = m_inventorApplication.ActiveDocument;

            BrowserPanes oPanes = default(BrowserPanes);

            oPanes = oDoc.BrowserPanes;

            //Create a standard Microsoft Windows IPictureDisp referencing an icon (.bmp) bitmap file.
            //Change the file referenced here as appropriate - here the code references test.bmp.
            //This is the icon that will be displayed at this node. Add the IPictureDisp to the client node resource.

            ClientNodeResources oRscs = oPanes.ClientNodeResources;

            stdole.IPictureDisp clientNodeIcon = AxHostConverter.ImageToPictureDisp(new Bitmap(@"Resources\test.bmp"));

            ClientNodeResource oRsc = oRscs.Add(m_ClientId, 1, clientNodeIcon);

            BrowserNodeDefinition oDef = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition("Top Node", 3, oRsc);

            //adding a new pane tab to the panes collection, define the top node the pane will contain.
            Inventor.BrowserPane oPane = oPanes.AddTreeBrowserPane("My Pane", m_ClientId, oDef);

            //Add two child nodes to the tree, labeled Node 2 and Node 3.
            BrowserNodeDefinition oDef1  = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition("Node2", 5, oRsc);
            BrowserNode           oNode1 = oPane.TopNode.AddChild(oDef1);

            BrowserNodeDefinition oDef2  = (BrowserNodeDefinition)oPanes.CreateBrowserNodeDefinition("Node3", 6, oRsc);
            BrowserNode           oNode2 = oPane.TopNode.AddChild(oDef2);

            //Add the native node (from root)  of "Model" pane to the tree
            BrowserNode oNativeRootNode = default(BrowserNode);

            oNativeRootNode = oDoc.BrowserPanes["Model"].TopNode;

            oPane.TopNode.AddChild(oNativeRootNode.BrowserNodeDefinition);
        }