次の方法で共有


Partner Content Discoverability Options in Visual Studio 2010, Part II: Shortcuts

One of the side benefits of the F1 feature I wrote about the other day is that vendors can effectively create VS IDE Help menu and Start menu shortcuts to their own documentation that will always work, regardless of the end-user's online/offline preference.

 

The VS 2010 Documentation shortcut looks something like this:

 

ms-xhelp:///?method=f1&query=msdnstart&product=vs&productVersion=100&locale=en-us

 

This is just a call to our query API and can be used anywhere once Help Viewer 1.0 is installed.

 

3rd party integrators can essentially replace that ‘msdnstart’ keyword highlighted above with an F1 keyword that maps to perhaps a portal page in their own content. This would then result in Help being opened up to the Partner content page, again regardless of the end-user’s online/offline state.

 

Creating an item on the Help menu in the IDE is accomplished by using the method described in VSPackage Tutorial 1: How to Create a VSPackage.

 

The wizard will result in creating a menu item on the Tools menu and will be defined in a MenuCommandsPackage.vsct file. To get your menu item to show up on the Help menu, look for the following item in this file:

<Group guid="guidMenuCommandsPackageCmdSet" id="MyMenuGroup" priority="0x0600">

<Parent guid="guidSHLMainMenu" id="IDM_VS_MENU_TOOLS"/>

</Group>

and replace the Parent element with:

 

<Parent guid="guidSHLMainMenu" id="IDM_VS_MENU_HELP"/>

  

You can also adjust the string that is used for your menu item and the bitmap that is displayed through entries in this same file.

 

Finally, to hook up the menu item to your help topic, there should have been a MenuCommandsPackage.cs (or similarly named file) added to your solution after completing the wizard. The methods are stubbed out with message box code to help you prove to yourself that your menu is running. After following the steps I described on this page for adding references for the IVsHelp interfaces, you can add a pretty straightforward call to a page in your content.

private void MenuItemCallback(object sender, EventArgs e)
{

Help help = (VsHelp.Help)GetService(typeof(SVsHelp));

help.DisplayTopicFromF1Keyword(

"VS.DevPartner.ReportGen.Settings");

}