/// <summary>
        /// Update tree node by xml representated siebel PS
        /// </summary>
        /// <param name="node">tree-node for updating</param>
        /// <param name="ps"> xml-node, represented ps or it child</param>
        private void SetPs(TreeNode node, XmlNode ps)
        {
            TreeNode     tn   = null;
            SiebProperty prop = new SiebProperty(SiebProperty.RecoveNameFromXml(ps.Name), "", SiebProperty.PropertyType.PropertySet);

            prop.ToTreeNode(node);
            if (ps.NodeType == XmlNodeType.Element) //else - if xml not correct
            {
                foreach (XmlAttribute a in ps.Attributes)
                {
                    node.Nodes.Add(new SiebProperty(SiebProperty.RecoveNameFromXml(a.Name), a.Value).ToTreeNode());
                }
            }

            foreach (XmlNode n in ps.ChildNodes)
            {
                switch (n.NodeType)
                {
                case XmlNodeType.Element:
                    tn = new TreeNode();
                    SetPs(tn, n);
                    node.Nodes.Add(tn);
                    break;

                case XmlNodeType.Text:
                    prop.Value = n.Value;
                    prop.ToTreeNode(node);
                    break;
                }
            }
        }
        private void SetPs(TreeNode node, SiebelWrapper.PropertySet ps)
        {
            //SiebProperty prop = new SiebProperty( ps.GetType(), ps.GetValue(), SiebProperty.PropertyType.PropertySet);
            SiebProperty prop     = new SiebProperty(ps.PsType, ps.PsValue, SiebProperty.PropertyType.PropertySet);
            string       propName = "";

            prop.ToTreeNode(node);
            //for (int i = 0; i < ps.GetPropertyCount(); i++)
            for (int i = 0; i < ps.PropertyCount; i++)
            {
                if (i == 0)
                {
                    propName = ps.GetFirstProperty();
                }
                else
                {
                    propName = ps.GetNextProperty();
                }
                //node.Nodes.Add(new SiebProperty(propName, ps.GetProperty(propName)).ToTreeNode());
                node.Nodes.Add(new SiebProperty(propName, ps.Property(propName)).ToTreeNode());
            }
            //for (int i = 0; i < ps.GetChildCount(); i++)
            for (int i = 0; i < ps.ChildCount; i++)
            {
                //SIEBELHTMLLib.SiebelPropertySet n = ps.GetChild(i);
                SiebelWrapper.PropertySet n = ps.GetChild(i);
                TreeNode tn = new TreeNode();
                SetPs(tn, n);
                node.Nodes.Add(tn);
            }
        }
Exemple #3
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            SiebProperty prop = (SiebProperty)Node.Tag;

            prop.Value = txtValue.Text;
            prop.Name  = txtName.Text;
            prop.ToTreeNode(Node);
            this.DialogResult = DialogResult.OK;
        }
        private void btvAddChild_Click(object sender, EventArgs e)
        {
            SiebProperty p        = new SiebProperty(txtPropName.Text, txtPropValue.Text, SiebProperty.PropertyType.PropertySet);
            TreeNode     propNode = p.ToTreeNode();

            tvIps.Focus();
            TreeNode addTo = null;

            if (tvIps.SelectedNode == null)
            {
                addTo = tvIps.Nodes[0];
            }
            else if (((SiebProperty)(tvIps.SelectedNode.Tag)).Type == SiebProperty.PropertyType.PropertySet)
            {
                addTo = tvIps.SelectedNode;
            }
            else
            {
                addTo = tvIps.SelectedNode.Parent;
            }
            addTo.Nodes.Add(propNode);
            tvIps.SelectedNode = propNode;
        }