/// <summary> /// Adds a new criteria to an award from the Add Critera Dialog /// </summary> private void AddNewCriteria(object sender, FormClosingEventArgs e) { // If there is a node referenced. if (ConditionNode != null && ConditionNode.Tag is ConditionList) { Condition Add = Child.GetCondition(); ConditionList List = (ConditionList)ConditionNode.Tag; List.Add(Add); } else { // No Node referenced... Use top most ConditionList A = new ConditionList(ConditionType.And); Condition B = SelectedAward.GetCondition(); if (B is ConditionList) { ConditionList C = (ConditionList)B; if (C.Type == ConditionType.And) { A = C; } else { A.Add(B); } } else { // Add existing conditions into the condition list A.Add(B); } // Add the new condition A.Add(Child.GetCondition()); // Parse award conditions into tree view SelectedAward.SetCondition(A); } // Update the tree view AwardConditionsTree.BeginUpdate(); AwardConditionsTree.Nodes.Clear(); AwardConditionsTree.Nodes.Add(SelectedAward.ToTree()); ValidateConditions(SelectedAwardNode, SelectedAward.GetCondition()); AwardConditionsTree.ExpandAll(); AwardConditionsTree.EndUpdate(); }
/// <summary> /// Adds a new criteria to an award from the Add Critera Dialog /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AddNewCriteria(object sender, FormClosingEventArgs e) { Condition Add = Child.GetCondition(); if (Add != null) { ConditionTree.Nodes[0].Nodes.Add(Add.ToTree()); UpdateRoot(); } }