Example #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("就绪");
        }
Example #2
0
        private static void UnLoadMe()
        {
            if (isLoad == false)
            {
                return;
            }
            isLoad = false;
            HandEvents.RemoveHandAllEvents();
            foreach (var item in Common.asmCommands)
            {
                Exception ex = Common.DeleteCommand(Common.chMenu, item.GetType().Name, item.Title);
            }

            try
            {
                Common.chMenu.Delete(null);
            }
            catch (Exception)
            {
            }
            try
            {
                Common.DelOpenFloderForVS();
            }
            catch (Exception)
            {
            }


            try
            {
                Common.chAddIN.Remove();
            }
            catch (Exception)
            {
            }
        }