Microsoft 9GD00001 Computer Accessories User Manual


 
Chapter 13: Extending Visual Studio 2010 393
outPane.OutputString(
"Command: " & cmd.Name &
", Shortcut: " & bindingStr &
Environment.NewLine)
End If
Next
handled = True
Exit Sub
End If
End If
End Sub
The executeOption parameter of Exec allows you to determine whether you want
to prompt the user for input, perform the action, or show help, which are options of the
vsCommandExecOption. All you need to do is check the option and perform the operation for
the current value of executeOption. In the current Add-In, we only check for vsCommandExec
OptionDoDefault, which means to just perform the operation:
C#:
if(executeOption ==
vsCommandExecOption.vsCommandExecOptionDoDefault)
VB:
If executeOption =
vsCommandExecOption.vsCommandExecOptionDoDefault Then
The example in this chapter only has one command, but you could potentially have
multiple commands if you decided to add more commands in the OnConnection method.
Add an if statement to ensure you’re executing code for the proper command, such as the
following code:
C#:
if (commandName ==
"KeystrokeFinder.Connect.KeystrokeFinder")
VB:
If commandName =
"KeystrokeFinderVB.Connect.KeystrokeFinderVB" Then