コード例 #1
0
ファイル: SetupForm.cs プロジェクト: nagyist/IR-Server-Suite
        private void buttonOK_Click(object sender, EventArgs e)
        {
            // Save menu ...
            MPBlastZonePlugin.Menu.Clear();
            foreach (TreeNode collectionNode in treeViewMenu.Nodes)
            {
                MenuFolder collection = new MenuFolder(collectionNode.Text);
                MPBlastZonePlugin.Menu.Add(collection);

                foreach (TreeNode commandNode in collectionNode.Nodes)
                {
                    string commandValue = String.Empty;
                    if (commandNode.Nodes.Count == 1)
                    {
                        commandValue = commandNode.Nodes[0].Text;
                    }

                    MenuCommand command = new MenuCommand(commandNode.Text, commandValue);
                    collection.Add(command);
                }
            }
            MPBlastZonePlugin.Menu.Save(MPBlastZonePlugin.MenuFile);

            DialogResult = DialogResult.OK;
            Close();
        }
コード例 #2
0
ファイル: Menu.cs プロジェクト: astalavister/IR-Server-Suite
    public MenuRoot(string fileName) : this()
    {
      XmlDocument doc = new XmlDocument();
      doc.Load(fileName);

      XmlNodeList listCollections = doc.DocumentElement.SelectNodes("collection");

      foreach (XmlNode nodeCollection in listCollections)
      {
        MenuFolder newCollection = new MenuFolder(nodeCollection.Attributes["name"].Value);
        _items.Add(newCollection);

        foreach (XmlNode nodeCommand in nodeCollection.SelectNodes("command"))
        {
          MenuCommand newCommand = new MenuCommand(nodeCommand.Attributes["name"].Value,
                                                   nodeCommand.Attributes["value"].Value);
          newCollection.Add(newCommand);
        }
      }
    }
コード例 #3
0
        public MenuRoot(string fileName) : this()
        {
            XmlDocument doc = new XmlDocument();

            doc.Load(fileName);

            XmlNodeList listCollections = doc.DocumentElement.SelectNodes("collection");

            foreach (XmlNode nodeCollection in listCollections)
            {
                MenuFolder newCollection = new MenuFolder(nodeCollection.Attributes["name"].Value);
                _items.Add(newCollection);

                foreach (XmlNode nodeCommand in nodeCollection.SelectNodes("command"))
                {
                    MenuCommand newCommand = new MenuCommand(nodeCommand.Attributes["name"].Value,
                                                             nodeCommand.Attributes["value"].Value);
                    newCollection.Add(newCommand);
                }
            }
        }
コード例 #4
0
 public void Remove(MenuFolder item)
 {
     _items.Remove(item);
 }
コード例 #5
0
 public void Add(MenuFolder item)
 {
     _items.Add(item);
 }
コード例 #6
0
    private void buttonOK_Click(object sender, EventArgs e)
    {
      // Save menu ...
      MPBlastZonePlugin.Menu.Clear();
      foreach (TreeNode collectionNode in treeViewMenu.Nodes)
      {
        MenuFolder collection = new MenuFolder(collectionNode.Text);
        MPBlastZonePlugin.Menu.Add(collection);

        foreach (TreeNode commandNode in collectionNode.Nodes)
        {
          string commandValue = String.Empty;
          if (commandNode.Nodes.Count == 1)
            commandValue = commandNode.Nodes[0].Text;

          MenuCommand command = new MenuCommand(commandNode.Text, commandValue);
          collection.Add(command);
        }
      }
      MPBlastZonePlugin.Menu.Save(MPBlastZonePlugin.MenuFile);

      DialogResult = DialogResult.OK;
      Close();
    }
コード例 #7
0
ファイル: Menu.cs プロジェクト: astalavister/IR-Server-Suite
 public void Remove(MenuFolder item)
 {
   _items.Remove(item);
 }
コード例 #8
0
ファイル: Menu.cs プロジェクト: astalavister/IR-Server-Suite
 public void Add(MenuFolder item)
 {
   _items.Add(item);
 }