Hi Andrey, I remember having this problem a long time ago... from memory the solution I used was to move the 'TrayItem' into a property instead of having it in the commandmethod:
Private m_TrayItem As AAW.TrayItem = Nothing
''' <summary>
'''
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public ReadOnly Property TrayItem() As AAW.TrayItem
Get
If Me.m_TrayItem Is Nothing Then
Me.m_TrayItem = New Autodesk.AutoCAD.Windows.TrayItem
Me.m_TrayItem.Icon = My.Resources.AutoPurge
Me.m_TrayItem.ToolTipText = AUTO_PURGE_TOOLTIP
Me.m_TrayItem.Visible = True
AddHandler m_TrayItem.MouseDown, AddressOf callback_MouseDown
End If
Return Me.m_TrayItem
End Get
End Property
this code is untested, but should work:
<commandmethod("test")> _
public sub testtrayitem ()
applicationservices.application.StatusBar.TrayItems.Add(Me.TrayItem)
applicationservices.application.UpdateScreen()
end sub
this may also solve the issue (see bottom of page for solution):
http://forums.autodesk.com/t5/NET/TrayItem-Icon-disappears/td-p/2386483