Commands displayed in the context menu
Commands displayed in the context menu

In order to add context menu it is required to call the AddContextMenu method and pass the enumerator as a template parameter.

It is required to provide the void handler function with a parameter of enumerator which will be called by framework when command is clicked.

It is optionally required to specify the selection type of where this menu should be displayed.

VB.NET

AddContextMenu(Of Commands_e)(AddressOf OnCommand, swSelectType_e.swSelCOMPONENTS)

Private Sub OnCommand(ByVal cmd As Commands_e)
End Sub

C#

AddContextMenu<Commands_e>(OnCommand, swSelectType_e.swSelCOMPONENTS);

private void OnCommand(Commands_e cmd) 
{
}