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);
            }
        }
        private void RunFunction()
        {
            SiebelWrapper sw = new SiebelWrapper();

            SiebelWrapper.PropertySet ips = new SiebelWrapper.PropertySet();
            SiebelAnswer answer;

            GetPs(ref ips, tvIps.Nodes[0], false);

            //ops = sw.InvokeMethod(txtService.Text, txtFunction.Text, ips);
            answer = sw.InvokeMethod(txtService.Text, txtFunction.Text, ips.GetChild(0));

            tvOps.Nodes[0].Nodes.Clear();
            (new SiebProperty("", "", SiebProperty.PropertyType.PropertySet)).ToTreeNode(tvOps.Nodes[0]);
            tvLog.Nodes[0].Nodes.Clear();
            SetPs(tvLog.Nodes[0], answer.InvokeMethodResult);
            tvLog.ExpandAll();

            if (answer.IsError)
            {
                MessageBox.Show(answer.ErrorMessage, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                SetPs(tvOps.Nodes[0], answer.FunctionResult);
                tvOps.ExpandAll();
                txtService.AutoCompleteCustomSource.Add(txtService.Text);
                txtFunction.AutoCompleteCustomSource.Add(txtFunction.Text);
            }
        }