/// <summary> /// Brings up the Criteria Editor for the selected Award Condition Node /// </summary> public void EditCriteria() { // Make sure we have a node selected if (ConditionNode == null) { MessageBox.Show("Please select a criteria to edit."); return; } // Make sure its a child node if (ConditionNode.Parent == null && ConditionNode.Nodes.Count != 0) { return; } // Open correct condition editor form if (ConditionNode.Tag is ObjectStat) { Child = new ObjectStatForm(ConditionNode); } else if (ConditionNode.Tag is PlayerStat) { Child = new ScoreStatForm(ConditionNode); } else if (ConditionNode.Tag is MedalOrRankCondition) { Child = new MedalConditionForm(ConditionNode); } else if (ConditionNode.Tag is GlobalStatMultTimes) { Child = new GlobalStatMultTimesForm(ConditionNode); } else if (ConditionNode.Tag is ConditionList) { Child = new ConditionListForm(ConditionNode); } else { return; } if (Child.ShowDialog() == DialogResult.OK) { // Delay tree redraw AwardConditionsTree.BeginUpdate(); // Set awards new conditions from the tree node tagged conditions SelectedAward.SetCondition(MedalDataParser.ParseNodeConditions(AwardConditionsTree.Nodes[0])); // Clear all current Nodes AwardConditionsTree.Nodes.Clear(); // Reparse conditions AwardConditionsTree.Nodes.Add(SelectedAward.ToTree()); // Validation highlighting ValidateConditions(SelectedAwardNode, SelectedAward.GetCondition()); // Conditions tree's are to be expanded at all times AwardConditionsTree.ExpandAll(); AwardConditionsTree.EndUpdate(); } }