using System;
using Extensibility;
using EnvDTE;
using EnvDTE80;
namespace VsDingExtension
{
/// The object for implementing an Add-in.
///
public class Connect : IDTExtensibility2
{
/// Implements the constructor for the Add-in object. Place your initialization code within this method.
public Connect()
{
}
/// Implements the OnConnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being loaded.
/// Root object of the host application.
/// Describes how the Add-in is being loaded.
/// Object representing this Add-in.
///
public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
applicationObject = (DTE2)application;
addInInstance = (AddIn)addInInst;
}
/// Implements the OnDisconnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being unloaded.
/// Describes how the Add-in is being unloaded.
/// Array of parameters that are host application specific.
///
public void OnDisconnection(ext_DisconnectMode disconnectMode, ref Array custom)
{
}
/// Implements the OnAddInsUpdate method of the IDTExtensibility2 interface. Receives notification when the collection of Add-ins has changed.
/// Array of parameters that are host application specific.
///
public void OnAddInsUpdate(ref Array custom)
{
}
/// Implements the OnStartupComplete method of the IDTExtensibility2 interface. Receives notification that the host application has completed loading.
/// Array of parameters that are host application specific.
///
public void OnStartupComplete(ref Array custom)
{
applicationObject.Events.BuildEvents.OnBuildDone += BuildEventsOnOnBuildDone;
}
private void BuildEventsOnOnBuildDone(vsBuildScope scope, vsBuildAction action)
{
System.Media.SystemSounds.Asterisk.Play();
}
/// Implements the OnBeginShutdown method of the IDTExtensibility2 interface. Receives notification that the host application is being unloaded.
/// Array of parameters that are host application specific.
///
public void OnBeginShutdown(ref Array custom)
{
}
private DTE2 applicationObject;
private AddIn addInInstance;
}
}