Skip to content

Commit

Permalink
Added implemented the StandardAddInServer.Deactivate methode
Browse files Browse the repository at this point in the history
  • Loading branch information
hjalte79 committed Sep 25, 2022
1 parent 9946893 commit 6b56680
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
10 changes: 9 additions & 1 deletion MyILogicAddin/MyButton.vb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,21 @@
Public Class MyButton
Private _inventor As Inventor.Application
Private _settingsButton As ButtonDefinition
Private _control As CommandControl
Public Sub New(inventor As Inventor.Application)
_inventor = inventor

SetupButtonDefinition()
AddButtonDefinitionToRibbon()
End Sub

Public Sub Unload()
_control.Delete()
_control = Nothing
_settingsButton.Delete()
_settingsButton = Nothing
End Sub

Private Sub SetupButtonDefinition()

Dim conDefs As ControlDefinitions = _inventor.CommandManager.ControlDefinitions
Expand All @@ -31,7 +39,7 @@ Public Class MyButton
Dim ribbon As Ribbon = _inventor.UserInterfaceManager.Ribbons.Item("Assembly")
Dim ribbonTab As RibbonTab = ribbon.RibbonTabs.Item("id_TabManage")
Dim ribbonPanel As RibbonPanel = ribbonTab.RibbonPanels.Item("iLogic.RibbonPanel")
ribbonPanel.CommandControls.AddButton(_settingsButton)
_control = ribbonPanel.CommandControls.AddButton(_settingsButton)

End Sub

Expand Down
3 changes: 2 additions & 1 deletion MyILogicAddin/StandardAddInServer.vb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ Public Class StandardAddInServer
''' AddIn should complete shutdown within this call.
''' </summary>
Public Sub Deactivate() Implements ApplicationAddInServer.Deactivate

_myButton.Unload()
_myButton = Nothing
End Sub

''' <summary>
Expand Down

0 comments on commit 6b56680

Please sign in to comment.