/// <summary> /// This function is the callback used to execute a command when the a menu item is clicked. /// See the Initialize method to see how the menu item is associated to this function using /// the OleMenuCommandService service and the MenuCommand class. /// </summary> private void MenuItemCallback(object sender, EventArgs e) { // Show a Message Box to prove we were here if (sender is MenuCommand) { MenuCommand cmd = sender as MenuCommand; if (cmd.CommandID.ID == PkgCmdIDList.cmdidConnect) { if (m_conWin == null) m_conWin = new ConnectionWindow(MessageHandler); if (!m_conWin.IsVisible) m_conWin.Show(); } else if (cmd.CommandID.ID == PkgCmdIDList.cmdidDisconnect) { } else if (cmd.CommandID.ID == PkgCmdIDList.cmdidAddContentRef) { } } else { IVsUIShell uiShell = (IVsUIShell)GetService(typeof(SVsUIShell)); Guid clsid = Guid.Empty; int result; Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(uiShell.ShowMessageBox( 0, ref clsid, "CogaenEditExtension", string.Format(CultureInfo.CurrentCulture, "Inside {0}.MenuItemCallback()", this.ToString()), string.Empty, 0, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST, OLEMSGICON.OLEMSGICON_INFO, 0, // false out result)); } }
//////////////////////////////////////////////////////////////////////////// // Dispose protected override void Dispose(bool disposing) { m_connection.disconnect(); if (m_conWin != null) m_conWin.Close(); m_conWin = null; base.Dispose(disposing); }