public DTE_Command FindCommand(string InName, DTE_Output InOutput)
        {
            EnvDTE.Command found    = null;
            string         fullName = mAddin.ProgID + "." + InName;

            EnvDTE.Commands commands = mMain.dte2.Commands;

            try
            {
                found = commands.Item(fullName, -1);
            }
            catch (Exception excp)
            {
                found = null;
                string xx = excp.ToString();
            }

            if (found == null)
            {
                return(null);
            }
            else
            {
                return(new DTE_Command(mMain, found));
            }
        }
        public void EnumerateMenuControls(DTE_Output InOutput)
        {
            CommandBarControls controls = mBar.Controls;

            foreach (CommandBarControl control in controls)
            {
                Microsoft.VisualStudio.CommandBars.MsoControlType msoType = control.Type;
                InOutput.WriteLine(
                    "Control Caption: " + control.Caption + " type: " + msoType.ToString() +
                    " Enabled: " + control.Enabled.ToString());
                InOutput.WriteLine("   DescriptionText: " + control.DescriptionText);
                InOutput.WriteLine("   TooltipText: " + control.TooltipText);
                InOutput.WriteLine(
                    "  Index: " + control.Index.ToString() +
                    "  Id: " + control.Id.ToString());

                Command cmd     = mMain.Commandsx.Item(control.Id, -1);
                string  cmdName = cmd.Name;

                if (control.Type == MsoControlType.msoControlButton)
                {
                    CommandBarButton but  = (CommandBarButton)control;
                    DTE_Button       dbut = new DTE_Button(mMain, control);
                    InOutput.WriteLine("     " + dbut.Command.Name + " guid: " + dbut.CommandGuid +
                                       " LocalizedName:" + dbut.Command.command.LocalizedName);

                    DTE_Addin addin = mMain.FindAddinByGuid(dbut.CommandGuid);
                    if (addin != null)
                    {
                        InOutput.WriteLine("  addin progid:" + addin.ProgId);
                    }
                }
            }
        }
        public void EnumerateCommands(DTE_Output InOutput)
        {
            DTE_Commands cmds = GetCommands();
            int          jx   = 0;

            foreach (DTE_Command cmd in cmds)
            {
                ++jx;
                InOutput.WriteLine(
                    "Command " + cmd.Name + " ID:" + cmd.ID.ToString() +
                    " guid:" + cmd.Guid +
                    " jx: " + jx.ToString());
            }
        }
Exemple #4
0
        public void EnumerateControls(DTE_Output InOutput)
        {
            int ix = 0;

            foreach (Microsoft.VisualStudio.CommandBars.CommandBarControl control in mCmdBarPopup.Controls)
            {
                ++ix;
                InOutput.WriteLine(
                    "Caption: " + control.Caption + " Text: " + control.DescriptionText +
                    " index: " + control.Index.ToString() +
                    " Enabled: " + control.Enabled.ToString( ) +
                    " Visible: " + control.Visible.ToString( ) +
                    " Type: " + control.Type.ToString( ) +
                    " TypeCode: " + control.Type.GetTypeCode().ToString( ));
            }
        }