コード例 #1
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.ToTreeNoCollapse());
            ConditionTree.ExpandAll();
            ConditionTree.EndUpdate();
        }
コード例 #2
0
        /// <summary>
        /// Brings up the Criteria Editor for an Award
        /// </summary>
        public void EditCriteria()
        {
            TreeNode SelectedNode = ConditionTree.SelectedNode;

            // Make sure we have a node selected
            if (Node == null)
            {
                MessageBox.Show("Please select a criteria to edit.");
                return;
            }

            // Make sure its a child node
            if (SelectedNode.Parent == null && SelectedNode.Nodes.Count != 0)
                return;

            this.Node = SelectedNode;

            // Open correct condition editor form
            if (Node.Tag is ObjectStat)
                Child = new ObjectStatForm(Node);
            else if (Node.Tag is PlayerStat)
                Child = new ScoreStatForm(Node);
            else if (Node.Tag is MedalOrRankCondition)
                Child = new MedalConditionForm(Node);
            else if (Node.Tag is GlobalStatMultTimes)
                Child = new GlobalStatMultTimesForm(Node);
            else if (Node.Tag is ConditionList)
                Child = new ConditionListForm(Node);
            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.ToTreeNoCollapse());
                ConditionTree.Refresh();
                ConditionTree.ExpandAll();
            }
        }