Ejemplo n.º 1
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("就绪");
        }
Ejemplo n.º 2
0
        public static void ShowContextMenu(DTE2 dte, string commandBarName, Point point)
        {
            if (dte == null)
            {
                throw new ArgumentNullException("dte");
            }

            if (commandBarName == null)
            {
                throw new ArgumentNullException("commandBarName");
            }

            Commands2 commands = (Commands2)dte.Commands;

            Microsoft.VisualStudio.CommandBars.CommandBars commandBars = (Microsoft.VisualStudio.CommandBars.CommandBars)dte.CommandBars;
            Microsoft.VisualStudio.CommandBars.CommandBar  commandBar  = commandBars[commandBarName];

            commandBar.ShowPopup(point.X, point.Y);
        }
Ejemplo n.º 3
0
 public DTE_CommandBars(DTE_Main InMain)
 {
     mMain    = InMain;
     mCmdBars = (Microsoft.VisualStudio.CommandBars.CommandBars)mMain.dte2.CommandBars;
 }