| < Free Open Study > |
|
As always, you will create the framework (Connect class) of the new add-in using the Add-in Wizard. Create the add-in with the name "NET Desktop". Do not have the wizard create a user interface menu item, and do not have it create an About box. You will be creating both of these manually in the add-in.
I will not describe the steps of the Add-in Wizard because I did that in detail in Chapter 2. You may refer back to that chapter if you have any questions about using the wizard. If you do not want to create this add-in as I describe it, you can simply open the add-in for this chapter from the book's code, which is provided in the Downloads section of the Apress Web site (http://www.apress.com).
Although you've seen the Connect class generated by the wizard numerous times before, Listing 12-1 shows it again. You can see from this listing that when you don't let the wizard create a user interface command, there's very little code generated by the wizard. The only changes I made were to shorten the name of the application object and place continuation marks so that the code would fit on the page. I've highlighted the changes to the application object in boldface font.
Listing 12-1: Connect Class for the NET Desktop Add-in
Imports Microsoft.Office.Core imports Extensibility imports System.Runtime.InteropServices Imports EnvDTE <GuidAttribute("F555EECD-3A41-4925-A564-75B2FC619333"), _ ProgIdAttribute("NetDesktop.Connect")> _ Public Class Connect Implements Extensibility.IDTExtensibility2 Dim oVB As EnvDTE.DTE Dim addInInstance As EnvDTE.AddIn Public Sub OnBeginShutdown(ByRef custom As System.Array) _ Implements Extensibility.IDTExtensibility2.OnBeginShutdown End Sub Public Sub OnAddInsUpdate(ByRef custom As System.Array) _ Implements Extensibility.IDTExtensibility2.OnAddInsUpdate End Sub Public Sub OnStartupComplete(ByRef custom As System.Array) _ Implements Extensibility.IDTExtensibility2.OnStartupComplete End Sub Public Sub OnDisconnection(ByVal RemoveMode As _ Extensibility.ext_DisconnectMode, _ ByRef custom As System.Array) _ Implements Extensibility.IDTExtensibility2.OnDisconnection End Sub Public Sub OnConnection(ByVal application As Object, _ ByVal connectMode As Extensibility.ext_ConnectMode, _ ByVal addInInst As Object, ByRef custom As System.Array) _ Implements Extensibility.IDTExtensibility2.OnConnection oVB = CType(application, EnvDTE.DTE) addInInstance = CType(addInInst, EnvDTE.AddIn) End Sub End Class
| < Free Open Study > |
|