// ------------------------ FindSubCommandBar -----------------------
        public DTE_CommandBar FindSubCommandBar(string InName)
        {
            // the popup is a child menu on the CommandBar menu.
            Microsoft.VisualStudio.CommandBars.CommandBarControl toolsControl = null;
            toolsControl = mCmdBar.Controls[InName];

            // cast to a CommandBar
            Microsoft.VisualStudio.CommandBars.CommandBar subCmdBar = null;

            try
            {
                subCmdBar = (Microsoft.VisualStudio.CommandBars.CommandBar)toolsControl;
            }
            catch (Exception)
            {
                subCmdBar = null;
            }

            if (subCmdBar == null)
            {
                return(null);
            }
            else
            {
                return(new DTE_CommandBar(mMain, subCmdBar));
            }
        }
Example #2
0
        public static void LoadMe(bool ispack)
        {
            if (isLoad)
            {
                return;
            }
            try
            {
                Common.chOutWin = Common.chDTE.ToolWindows.OutputWindow.OutputWindowPanes.Item("KeelKit");
            }
            catch (Exception)
            {
                Common.chOutWin = Common.chDTE.ToolWindows.OutputWindow.OutputWindowPanes.Add("KeelKit");
            }
            Common.ShowInfo("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", true);
            Common.ShowInfo("@@@           KeelKit 2012                     @@@", true);
            Common.ShowInfo("@@@      http://www.mysticboy.cn               @@@", true);
            Common.ShowInfo("@@@          [email protected]                  @@@", true);
            Common.ShowInfo("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@", true);
            Common.ShowInfo("", true);

            if (ispack == false)
            {
                Common.chMenu = Common.GetMenuBar("KeelKit");
            }
            else
            {
                Commands2 Cmds = (Commands2)Common.chDTE.Commands;
                Microsoft.VisualStudio.CommandBars.CommandBars       CmdBars = (Microsoft.VisualStudio.CommandBars.CommandBars)Common.chDTE.CommandBars;
                Microsoft.VisualStudio.CommandBars.CommandBarControl mnu     = CmdBars["MenuBar"].Controls["KeelKit"];
                Common.chMenu = mnu;
            }
            Assembly asm = System.Reflection.Assembly.GetExecutingAssembly();

            Type[] ts = asm.GetTypes();
            foreach (Type var in ts)
            {
                if (var.FullName.StartsWith("KeelKit.Commands"))
                {
                    ICommand i = (ICommand)Assembly.GetExecutingAssembly().CreateInstance(var.FullName);
                    Common.asmCommands.Add(i);
                    i = null;
                }
            }
            Common.asmCommands.Sort(new Comparison <ICommand>(ComparisonCmd));
            foreach (var item in Common.asmCommands)
            {
                Exception ex = Common.AddCommand(Common.chMenu, item.GetType().Name, item.Title, item.IcoID);
                if (ex != null)
                {
                    Common.ShowInfo("加载菜单时出现异常:" + ex.Message);
                }
            }
            Common.AddOpenFloderFoVS();
            Common.AddCopyToHtmlForVS();
            HandEvents.HandAllEvents();
            isLoad = true;
            Common.ShowInfo("就绪");
        }
        public void CommandInfo(
            Microsoft.VisualStudio.CommandBars.CommandBarControl InControl,
            out string OutCmdGuid, out int OutCmdId)
        {
            string cmdGuid = null;
            int    cmdId   = 0;

            mCmds.CommandInfo(InControl, out cmdGuid, out cmdId);
            OutCmdGuid = cmdGuid;
            OutCmdId   = cmdId;
        }
        public DTE_CommandBarPopup FindCommandBarPopup(string InName)
        {
            // the popup is a child menu on the CommandBar menu.
            Microsoft.VisualStudio.CommandBars.CommandBarControl toolsControl = null;
            toolsControl = mCmdBar.Controls[InName];

            // cast to a CommandBarPopup
            Microsoft.VisualStudio.CommandBars.CommandBarPopup popup = null;
            popup = (Microsoft.VisualStudio.CommandBars.CommandBarPopup)toolsControl;

            if (popup == null)
            {
                return(null);
            }
            else
            {
                return(new DTE_CommandBarPopup(mMain, popup));
            }
        }