/// <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) { m_applicationObject = (DTE2)application; m_addInInstance = (AddIn)addInInst; //if (connectMode == ext_ConnectMode.ext_cm_UISetup) { object[] contextGUIDS = new object[] { }; try { //Add a command to the Commands collection: object[] contextUIGUIDs = new object[0]; m_applicationObject.Commands.AddNamedCommand(m_addInInstance, "GotoFunctionHeaderDown", "GotoFunctionHeaderDown", "Moves cursor to the next function definition.", true, 0, ref contextUIGUIDs, (int)vsCommandStatus.vsCommandStatusSupported + (int)vsCommandStatus.vsCommandStatusEnabled); } catch (System.ArgumentException) { //If we are here, then the exception is probably because a command with that name // already exists. If so there is no need to recreate the command and we can // safely ignore the exception. } try { //Add a command to the Commands collection: object[] contextUIGUIDs = new object[0]; m_applicationObject.Commands.AddNamedCommand(m_addInInstance, "GotoFunctionHeaderUp", "GotoFunctionHeaderUp", "Moves cursor to the previous function definition.", true, 0, ref contextUIGUIDs, (int)vsCommandStatus.vsCommandStatusSupported + (int)vsCommandStatus.vsCommandStatusEnabled); } catch (System.ArgumentException) { } try { //Add a command to the Commands collection: object[] contextUIGUIDs = new object[0]; m_applicationObject.Commands.AddNamedCommand(m_addInInstance, "InsertMethodHeader", "InsertMethodHeader", "Insert a class or method XML tag block sandwiched between a set of dashed lines.", true, 0, ref contextUIGUIDs, (int)vsCommandStatus.vsCommandStatusSupported + (int)vsCommandStatus.vsCommandStatusEnabled); } catch (System.ArgumentException) { } try { //Add a command to the Commands collection: object[] contextUIGUIDs = new object[0]; m_applicationObject.Commands.AddNamedCommand(m_addInInstance, "ToggleHAndCpp", "ToggleHAndCpp", "Toggle between the .H and .CPP files.", true, 0, ref contextUIGUIDs, (int)vsCommandStatus.vsCommandStatusSupported + (int)vsCommandStatus.vsCommandStatusEnabled); } catch (System.ArgumentException) { } } m_commands = new AddinCommands(m_applicationObject); }