
390Microsoft Visual Studio 2010: A Beginner’s Guide
true, 59, ref contextGUIDS, (int)vsCommandStatus
.vsCommandStatusSupported+
(int)vsCommandStatus.vsCommandStatusEnabled,
(int)vsCommandStyle
.vsCommandStylePictAndText, vsCommandControlType
.vsCommandControlTypeButton);
VB:
Dim command As Command = commands.AddNamedCommand2(
_addInInstance, "KeystrokeFinderVB", "KeystrokeFinderVB",
"Executes the command for KeystrokeFinderVB", True, 59, Nothing, CType(vsCommandStatus.vsCommandStatusSupported,
Integer) + CType(vsCommandStatus.vsCommandStatusEnabled,
Integer),
vsCommandStyle.vsCommandStylePictAndText,
vsCommandControlType.vsCommandControlTypeButton)
AddNamedCommand2 returned a Command object, command, which must be placed into VS somewhere so that a user can click it to invoke the
C#:
if((command != null) && (toolsPopup != null))
{
command.AddControl( toolsPopup.CommandBar, 1);
}
VB:
command.AddControl(toolsPopup.CommandBar, 1)
This completes the responsibilities of the OnConnection method. If you had your own code for initializing the