380Microsoft Visual Studio 2010: A Beginner’s Guide

take an even closer look at the comments in the code for a better understanding of what that code does. The code comments are exactly the same in VB. Some of the comments refer to the host application, where the host is either the VS IDE or the VS Macro Editor, as was selected while running the Add-In Project Wizard in the preceding section and shown in Figure 13-3. I’ve removed the contents of each method because subsequent sections of this chapter will explain important method implementations and how to make the Add-In perform useful operations.

Listing 13-1 Skeleton code for the Connect class

using System;

using Extensibility; using EnvDTE; using EnvDTE80;

using Microsoft.VisualStudio.CommandBars; using System.Resources;

using System.Reflection; using System.Globalization;

namespace KeystrokeFinder

{

///<summary>The object for implementing an Add-in.</summary>

///<seealso class='IDTExtensibility2' />

public class Connect : IDTExtensibility2, IDTCommandTarget

{

///<summary>

///Implements the constructor for the Add-in object.

///Place your initialization code within this method.

///</summary>

public Connect()

{

}

///<summary>

///Implements the OnConnection method of the

///IDTExtensibility2 interface. Receives notification

///that the Add-in is being loaded.

///</summary>

///<param term='application'>

///Root object of the host application.

///</param>

///<param term='connectMode'>

///Describes how the Add-in is being loaded.

///</param>

Page 403
Image 403
Microsoft 9GD00001 manual Listing 13-1 Skeleton code for the Connect class