/// <summary> /// Brings up the Criteria Editor for an Award /// </summary> public void EditCriteria() { // Grab the selected treenode TreeNode SelectedNode = ConditionTree.SelectedNode; // Make sure we have a node selected if (SelectedNode == null) { MessageBox.Show("Please select a criteria to edit."); return; } // Make sure its a child node, and not the topmost if (SelectedNode.Parent == null) // && SelectedNode.Nodes.Count != 0) { return; } // Open correct condition editor form if (SelectedNode.Tag is ObjectStat) { Child = new ObjectStatForm(SelectedNode); } else if (SelectedNode.Tag is PlayerStat) { Child = new ScoreStatForm(SelectedNode); } else if (SelectedNode.Tag is MedalOrRankCondition) { Child = new MedalConditionForm(SelectedNode); } else if (SelectedNode.Tag is GlobalStatMultTimes) { Child = new GlobalStatMultTimesForm(SelectedNode); } else if (SelectedNode.Tag is ConditionList) { Child = new ConditionListForm(SelectedNode); } else { return; } if (Child.ShowDialog() == DialogResult.OK) { ConditionList NN = new ConditionList(List.Type); NN = (ConditionList)MedalDataParser.ParseNodeConditions(ConditionTree.Nodes[0]); ConditionTree.Nodes.Clear(); ConditionTree.Nodes.Add(NN.ToTree()); ConditionTree.Refresh(); ConditionTree.ExpandAll(); } }
/// <summary> /// Shows the correct new criteria screen when the uesr selects which type. /// </summary> private void NewCriteria_Closing(object sender, FormClosingEventArgs e) { ConditionForm C = Child.GetConditionForm(); if (C == null) { return; } // Hide closing New Criteria form, because setting "Child" to a new window // will still display the old window below it until the new child closes. Child.Visible = false; Child = C; Child.FormClosing += new FormClosingEventHandler(AddNewCriteria); Child.ShowDialog(); }
/// <summary> /// Shows the correct new criteria screen when the uesr selects which type. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void NewCriteria_Closing(object sender, FormClosingEventArgs e) { ConditionForm C = Child.GetConditionForm(); if (C == null) return; // Hide closing New Criteria form, because setting "Child" to a new window // will still display the old window below it until the new child closes. Child.Visible = false; Child = C; Child.FormClosing += new FormClosingEventHandler(AddNewCriteria); Child.ShowDialog(); }
/// <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(); } }