void AddCondition(TreeNode root, XmlCondition condition)
        {
            if (condition != null)
            {
                TreeNode node = null;

                if (condition is XmlSimpleCondition)
                {
                    node = new TreeNode("condition");
                }
                else
                {
                    node = new TreeNode((condition as XmlComplexCondition).BinaryOperator.ToString().Replace("Operator", ""));
                    AddCondition(node, (condition as XmlComplexCondition).Condition1);
                    AddCondition(node, (condition as XmlComplexCondition).Condition2);
                }
                node.Tag = condition;
                if (root == null)
                {
                    treeView1.Nodes.Add(node);
                }
                else
                {
                    root.Nodes.Add(node);
                }
            }
        }
Example #2
0
        /// <summary>
        /// Serializes the condition by creating a serializabe instance of the XmlCondition
        /// class.
        /// </summary>
        /// <returns></returns>
        public XmlCondition Serialize()
        {
            XmlCondition res = this.CreateSerializableInstance();

            this.SerializeProperties(res);

            return(res);
        }
Example #3
0
        protected override void SerializeProperties(XmlCondition res)
        {
            base.SerializeProperties(res);
            XmlComplexCondition instance = (XmlComplexCondition)res;

            instance.Condition1     = this.Condition1.Serialize();
            instance.Condition2     = this.Condition2.Serialize();
            instance.BinaryOperator = this.BinaryOperator;
        }
Example #4
0
        protected override void SerializeProperties(XmlCondition res)
        {
            base.SerializeProperties(res);

            XmlSimpleCondition instance = (XmlSimpleCondition)res;

            instance.Setting       = this.Setting.Serialize();
            instance.UnaryOperator = this.UnaryOperator;
        }
Example #5
0
        protected override Condition CreateInstance()
        {
            Condition condition1 = null;
            Condition condition2 = null;

            //if (this.Condition1 != null)
            {
                condition1 = this.Condition1.Deserialize();
            }

            //if (this.Condition2 != null)
            {
                condition2 = this.Condition2.Deserialize();
            }
            return(new ComplexCondition(condition1, this.BinaryOperator, condition2));
        }
        public ConditionBuilderForm(XmlCondition condition)
        {
            InitializeComponent();

            propertyGrid1.PropertyValueChanged += new PropertyValueChangedEventHandler(propertyGrid1_PropertyValueChanged);

            if (condition == null)
            {
                TreeNode node = new TreeNode("condition");
                node.Tag = new XmlSimpleCondition();
                treeView1.Nodes.Add(node);
            }
            else
            {
                AddCondition(null, condition);
            }

            label1.Text = BuildConditionString(treeView1.Nodes[0]);

            ExpandTreeToLevel(treeView1.Nodes, 3);
        }
Example #7
0
 protected virtual void SerializeProperties(XmlCondition res)
 {
 }