/// <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> /// <param term='addInInst'>Object representing this Add-in.</param> /// <seealso class='IDTExtensibility2' /> public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom) { _applicationObject = (DTE2)application; _addInInstance = (AddIn)addInInst; _manager = DesktopManager.Instance(_applicationObject); if (connectMode == ext_ConnectMode.ext_cm_UISetup) { var commands = (Commands2)_applicationObject.Commands; var bars = (CommandBars)_applicationObject.CommandBars; _manager.CreateButtons(bars, commands, _addInInstance); } }
public static DesktopManager Instance(DTE2 applicationObject) { return(_instance ?? (_instance = new DesktopManager(applicationObject))); }