From bf4088972259e554c18cd27519ad19492dff5fb2 Mon Sep 17 00:00:00 2001 From: jmethot79 Date: Thu, 16 Apr 2015 06:48:12 -0400 Subject: [PATCH] Fixed menu item visibility --- CarbonCopy/CarbonCopyPackage.cs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/CarbonCopy/CarbonCopyPackage.cs b/CarbonCopy/CarbonCopyPackage.cs index 6e1c40e..1ada800 100644 --- a/CarbonCopy/CarbonCopyPackage.cs +++ b/CarbonCopy/CarbonCopyPackage.cs @@ -32,7 +32,8 @@ namespace Zinc.CarbonCopy // This attribute is needed to let the shell know that this package exposes some menus. [ProvideMenuResource("Menus.ctmenu", 1)] [Guid(GuidList.guidCarbonCopyPkgString)] - [ProvideAutoLoad(UIContextGuids80.Debugging)] + //[ProvideAutoLoad(UIContextGuids80.Debugging)] + [ProvideAutoLoad("f1536ef8-92ec-443c-9ed7-fdadf150da82")] public sealed class CarbonCopyPackage : Package { /// @@ -68,24 +69,21 @@ protected override void Initialize() { // Create the command for the menu item. CommandID menuCommandID = new CommandID(GuidList.guidCarbonCopyCmdSet, (int)PkgCmdIDList.cmdidCopyDeclaration); - MenuCommand menuItem = new MenuCommand(MenuItemCallback, menuCommandID ); - - //CommandID projectMenuCommandID = new CommandID(GuidList.Interactive_WindowCmdSet, (int)PkgCmdIDList.cmdidLoadUI); - //OleMenuCommand projectmenuItem = new OleMenuCommand(MenuItemCallback, menuCommandID); - //projectmenuItem.BeforeQueryStatus += menuCommand_BeforeQueryStatus; - - mcs.AddCommand( menuItem ); - + + OleMenuCommand projectmenuItem = new OleMenuCommand(MenuItemCallback, menuCommandID); + mcs.AddCommand(projectmenuItem); + projectmenuItem.BeforeQueryStatus += menuCommand_BeforeQueryStatus; } } #endregion private void menuCommand_BeforeQueryStatus(object sender, EventArgs e) { - MessageBox.Show("test"); - OleMenuCommand menuCommand = sender as OleMenuCommand; + OleMenuCommand menuCommand = sender as OleMenuCommand; if (menuCommand != null) { + var dteInstance = (DTE)GetService(typeof(SDTE)); + menuCommand.Visible = dteInstance.Debugger.DebuggedProcesses.Count > 0; } }