예제 #1
0
        /// <summary>
        /// Intializes the condition tree
        /// </summary>
        private void Initialize()
        {
            // Add Conditions to tree view
            ConditionTree.BeginUpdate();
            ConditionTree.Nodes.Clear();
            ConditionTree.Nodes.Add(List.ToTree());
            ConditionTree.EndUpdate();
            ConditionTree.ExpandAll();

            // Get the list name
            ListTypeBox.Text = ConditionList.Names[(int)List.Type];

            // Proccess list descritpion
            if (List.Type == ConditionType.And || List.Type == ConditionType.Or)
            {
                ConditionDescBox.Text = "Can contain unlimited number of sub criteria's";
            }
            else
            {
                ConditionDescBox.Text  = "Must contain ";
                ConditionDescBox.Text += (List.Type == ConditionType.Not)
                    ? "1 Sub Criteria."
                    : "2 Sub Criteria's. An optinal 3rd \"Value\" Criteria can be applied.";
            }

            // Hide value box's for unsupporting condition lists
            if (List.Type != ConditionType.Plus && List.Type != ConditionType.Div)
            {
                EnableValue.Visible = false;
                ValueBox.Visible    = false;
            }
            else
            {
                // Get our condition value, and add its value to the valuebox
                List <Condition> CL = List.GetConditions();
                if (CL.Count == 3)
                {
                    EnableValue.Checked = true;
                    ValueBox.Value      = Int32.Parse(CL[2].ToString());
                }
                else
                {
                    EnableValue.Checked = false;
                }
            }
        }
예제 #2
0
        private void UpdateRoot()
        {
            ConditionList NList = new ConditionList(List.Type);

            // Add existing nodes to the new list
            foreach (TreeNode E in ConditionTree.Nodes[0].Nodes)
            {
                NList.Add((Condition)E.Tag);
            }

            // Add condition value if enabled
            if (ValueBox.Enabled)
            {
                NList.Add(new ConditionValue(ValueBox.Value.ToString()));
            }

            // update tree
            ConditionTree.BeginUpdate();
            ConditionTree.Nodes.Clear();
            ConditionTree.Nodes.Add(NList.ToTree());
            ConditionTree.ExpandAll();
            ConditionTree.EndUpdate();
        }