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

            command.CommandID = commandID;
            MenuCollection.Remove(command);
            command.TagEx = null;
        }
Example #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;
 }
Example #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);
        }
Example #4
0
        /// <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);
                                }
                            }
                        }
                    }
                }
            }
        }
Example #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) { }
 }
Example #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) { }
 }
Example #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));
        }
Example #8
0
        /// <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);
                                }
                            }
                        }
                    }
                }
            }
        }
Example #9
0
 public void UnRegisterCommand(CommandID commandID)
 {
     VSMenuCommand command = new VSMenuCommand();
     command.CommandID = commandID;
     MenuCollection.Remove(command);
     command.TagEx = null;
 }
Example #10
0
 public void UnRegisterCommand(VSMenuCommand command)
 {
     MenuCollection.Remove(command);
     command.TagEx = null;
 }
Example #11
0
 public void UnRegisterCommand(VSMenuCommand command)
 {
     MenuCollection.Remove(command);
     command.TagEx = null;
 }