示例#1
0
        public void UnRegisterCommand(CommandID commandID)
        {
            VSMenuCommand command = new VSMenuCommand();

            command.CommandID = commandID;
            MenuCollection.Remove(command);
            command.TagEx = null;
        }
示例#2
0
 public VSMenuCommand Copy()
 {
     VSMenuCommand cmdMenu = new VSMenuCommand();
     cmdMenu.Caption = this.Caption;
     cmdMenu.CommandID = this.CommandID;
     cmdMenu.Description = this.Description;
     cmdMenu.Enabled = this.Enabled;
     cmdMenu.Name = this.Name;
     cmdMenu.Position = this.Position;
     return cmdMenu;
 }
示例#3
0
        public VSMenuCommand Copy()
        {
            VSMenuCommand cmdMenu = new VSMenuCommand();

            cmdMenu.Caption     = this.Caption;
            cmdMenu.CommandID   = this.CommandID;
            cmdMenu.Description = this.Description;
            cmdMenu.Enabled     = this.Enabled;
            cmdMenu.Name        = this.Name;
            cmdMenu.Position    = this.Position;
            return(cmdMenu);
        }
示例#4
0
文件: PlugIn.cs 项目: Loong-Lee/VSDT
        /// <summary>
        /// 从xml启动插件
        /// </summary>
        private void StartFromXML()
        {
            List <ExtensionData> list = this.PlugInInfo.PlugInData.Extensions;

            for (int i = 0; i < list.Count; i++)
            {
                if (string.Compare(list[i].Point, ConstantString.VSMenuPoint, true) == 0)
                {
                    List <System.Xml.XmlNode> listNodes = list[i].ChildNodes;
                    for (int j = 0; j < listNodes.Count; j++)
                    {
                        if (string.Compare(listNodes[j].Name, "Application", true) == 0)
                        {
                            string title = listNodes[j].Attributes["Title"].Value.ToString();

                            foreach (System.Xml.XmlNode nodeTemp in listNodes[j].ChildNodes)
                            {
                                if (string.Compare(nodeTemp.Name, "Menu", true) == 0)
                                {
                                    string text      = nodeTemp.Attributes["Text"].Value.ToString();
                                    string className = nodeTemp.Attributes["Class"].Value.ToString();
                                    string commandID = nodeTemp.Attributes["ID"].Value.ToString();
                                    int    id        = int.Parse(commandID);
                                    Guid   guid      = this.plugInID;
                                    VSDT.Commands.VSMenuCommand cmd = new VSDT.Commands.VSMenuCommand();
                                    cmd.CommandID = new VSDT.Commands.CommandID(guid, id);
                                    cmd.Click    += new EventHandler(cmd_Click);
                                    cmd.Caption   = text;
                                    if (string.Compare(title, ConstantString.TopMenu, true) == 0)
                                    {
                                        cmd.Position = VSDT.MenuCommandPlace.MainMenu;
                                    }
                                    else if (string.Compare(title, ConstantString.SubMenu, true) == 0)
                                    {
                                        cmd.Position = VSDT.MenuCommandPlace.SubMenu;
                                    }
                                    VSDT.Commands.MenuManager.Instance.RegisterCommand(cmd);
                                    directory.Add(cmd, className);
                                }
                            }
                        }
                    }
                }
            }
        }
示例#5
0
 public void RegisterCommand(VSMenuCommand command)
 {
     try
     {
         if (MenuCollection.Contains(command))
         {
             throw new ApplicationException("试图注册按钮,但按钮已注册过");
         }
         if (command.CommandID == null)
         {
             throw new Exception("试图注册按钮,但按钮的CommandID为空");
         }
         MenuCollection.Add(command);
         //如果Add成功,添加改变事件
         command.TagEx = new object();
     }
     catch (ApplicationException ex) { }
 }
示例#6
0
 public void RegisterCommand(VSMenuCommand command)
 {
     try
     {
         if (MenuCollection.Contains(command))
         {
             throw new ApplicationException("试图注册按钮,但按钮已注册过");
         }
         if (command.CommandID == null)
         {
             throw new Exception("试图注册按钮,但按钮的CommandID为空");
         }
         MenuCollection.Add(command);
         //如果Add成功,添加改变事件
         command.TagEx = new object();
     }
     catch (ApplicationException ex) { }
 }
示例#7
0
        public override bool Equals(object obj)
        {
            VSMenuCommand vsTmp = obj as VSMenuCommand;

            if (vsTmp == null)
            {
                return(false);
            }
            if (vsTmp.CommandID == null)
            {
                if (this.CommandID == null)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            return(vsTmp.CommandID.Equals(this.CommandID));
        }
示例#8
0
文件: PlugIn.cs 项目: sunpander/VSDT
        /// <summary>
        /// 从xml启动插件
        /// </summary>
        private void StartFromXML()
        {
            List<ExtensionData> list = this.PlugInInfo.PlugInData.Extensions;
            for (int i = 0; i < list.Count; i++)
            {
                if (string.Compare(list[i].Point, ConstantString.VSMenuPoint, true) == 0)
                {
                    List<System.Xml.XmlNode> listNodes = list[i].ChildNodes;
                    for (int j = 0; j < listNodes.Count; j++)
                    {
                        if (string.Compare(listNodes[j].Name, "Application", true) == 0)
                        {
                            string title = listNodes[j].Attributes["Title"].Value.ToString();

                            foreach (System.Xml.XmlNode nodeTemp in listNodes[j].ChildNodes)
                            {
                                if (string.Compare(nodeTemp.Name, "Menu", true) == 0)
                                {
                                    string text = nodeTemp.Attributes["Text"].Value.ToString();
                                    string className = nodeTemp.Attributes["Class"].Value.ToString();
                                    string commandID = nodeTemp.Attributes["ID"].Value.ToString();
                                    int id = int.Parse(commandID);
                                    Guid guid = this.plugInID;
                                    VSDT.Commands.VSMenuCommand cmd = new VSDT.Commands.VSMenuCommand();
                                    cmd.CommandID = new VSDT.Commands.CommandID(guid, id);
                                    cmd.Click += new EventHandler(cmd_Click);
                                    cmd.Caption = text;
                                    if (string.Compare(title, ConstantString.TopMenu, true) == 0)
                                    {
                                        cmd.Position = VSDT.MenuCommandPlace.MainMenu;
                                    }
                                    else if (string.Compare(title, ConstantString.SubMenu, true) == 0)
                                    {
                                        cmd.Position = VSDT.MenuCommandPlace.SubMenu;
                                    }
                                    VSDT.Commands.MenuManager.Instance.RegisterCommand(cmd);
                                    directory.Add(cmd, className);
                                }
                            }
                        }
                    }
                }
            }
        }
示例#9
0
 public void UnRegisterCommand(CommandID commandID)
 {
     VSMenuCommand command = new VSMenuCommand();
     command.CommandID = commandID;
     MenuCollection.Remove(command);
     command.TagEx = null;
 }
示例#10
0
 public void UnRegisterCommand(VSMenuCommand command)
 {
     MenuCollection.Remove(command);
     command.TagEx = null;
 }
示例#11
0
 public void UnRegisterCommand(VSMenuCommand command)
 {
     MenuCollection.Remove(command);
     command.TagEx = null;
 }