Esempio n. 1
0
 private static void createProtocol(TreeNodeCollection tree, Block data)
 {
     Block temp = null;
     foreach (TreeNode t in tree)
     {
         if (t.Name.Equals("block"))
         {
             temp = data.addBlock(t.Text, t.ImageKey, t.SelectedImageKey);
             createProtocol(t.Nodes, temp);
         }
         else
         {
             if (t.Name.Equals("multi"))
             {
                 Field f = data.addField(t.Text, t.Name, "", t.SelectedImageKey);
                 string[] values = t.ImageKey.Split(';');
                 foreach (string s in values)
                 {
                     string[] pair = s.Split(':');
                     ((MultiField)f).addKey(pair[0], pair[1]);
                 }
             }
             else data.addField(t.Text, t.Name, t.ImageKey, t.SelectedImageKey);
         }
     }
 }
Esempio n. 2
0
        //going through the children of the blockNode and creates recursively the right structure
        private void innerBlocks(Block blockNode, XmlNodeList children)
        {
            foreach (XmlNode child in children)
            {
                if (child.Name == "block")
                {
                    String[] attr = getBlockAttr(child);
                    String name = attr[0];
                    String type = attr[1];
                    String info = attr[2];

                    Block block = blockNode.addBlock(name, type, info);
                    innerBlocks(block, child.ChildNodes);
                }
                else if (child.Name == "field")
                {
                    String[] attr = getFieldAttr(child);
                    String name = attr[0];
                    String type = attr[1];
                    String info = attr[2];
                    String description = attr[3];
                    Field field = blockNode.addField(name, type, info, description);
                    innerFields(field, child.ChildNodes);

                }
            }
        }