Inheritance: System.Windows.Forms.Form
コード例 #1
0
        /// <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();
            }
        }
コード例 #2
0
        /// <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();
        }
コード例 #3
0
        /// <summary>
        /// Select Button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnContinue_Click(object sender, EventArgs e)
        {
            if (GlobalStatRadio.Checked)
            {
                this.ParentF = new ScoreStatForm();
            }
            else if (ObjectStatRadio.Checked)
            {
                this.ParentF = new ObjectStatForm();
            }
            else if (AwardRadio.Checked)
            {
                this.ParentF = new MedalConditionForm();
            }
            else if (GlobalMultStatRadio.Checked)
            {
                this.ParentF = new GlobalStatMultTimesForm();
            }
            else if (GenericListRadio.Checked)
            {
                this.ParentF = new ConditionListForm(ConditionType.And);
            }
            else if (SumCriteriaList.Checked)
            {
                this.ParentF = new ConditionListForm(ConditionType.Plus);
            }
            else if (NotCriteriaList.Checked)
            {
                this.ParentF = new ConditionListForm(ConditionType.Not);
            }
            else if (DivCriteriaList.Checked)
            {
                this.ParentF = new ConditionListForm(ConditionType.Div);
            }
            else if (OrCriteriaList.Checked)
            {
                this.ParentF = new ConditionListForm(ConditionType.Or);
            }

            this.Close();
        }
コード例 #4
0
        /// <summary>
        /// Adding a new Criteria
        /// </summary>
        private void NewCriteriaMenuItem_Click(object sender, EventArgs e)
        {
            // Make sure an award is selected!!!!
            if (SelectedAwardNode == null || SelectedAwardNode.Parent == null)
            {
                MessageBox.Show("Please select an award!");
                return;
            }

            // Is this the root criteria node?
            TreeNode Node = AwardConditionsTree.SelectedNode;

            if (Node == null)
            {
                Child = new NewCriteriaForm();
            }

            // If plus or div, open edit form
            else if (Node.Tag is ConditionList)
            {
                ConditionList List = Node.Tag as ConditionList;
                if (List.Type == ConditionType.Plus || List.Type == ConditionType.Div)
                {
                    Child = new ConditionListForm(Node);
                }
                else
                {
                    Child = new NewCriteriaForm();
                }
            }

            // Base Condition
            else
            {
                Child = new NewCriteriaForm();
            }

            // Show child form
            Child.FormClosing += NewCriteria_Closing;
            Child.Show();
        }
コード例 #5
0
        /// <summary>
        /// Select Button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnContinue_Click(object sender, EventArgs e)
        {
            if (GlobalStatRadio.Checked)
                this.ParentF = new ScoreStatForm();
            else if (ObjectStatRadio.Checked)
                this.ParentF = new ObjectStatForm();
            else if (AwardRadio.Checked)
                this.ParentF = new MedalConditionForm();
            else if (GlobalMultStatRadio.Checked)
                this.ParentF = new GlobalStatMultTimesForm();
            else if (GenericListRadio.Checked)
                this.ParentF = new ConditionListForm(ConditionType.And);
            else if (SumCriteriaList.Checked)
                this.ParentF = new ConditionListForm(ConditionType.Plus);
            else if (NotCriteriaList.Checked)
                this.ParentF = new ConditionListForm(ConditionType.Not);
            else if (DivCriteriaList.Checked)
                this.ParentF = new ConditionListForm(ConditionType.Div);
            else if (OrCriteriaList.Checked)
                this.ParentF = new ConditionListForm(ConditionType.Or);

            this.Close();
        }
コード例 #6
0
        /// <summary>
        /// New Criteria menu item click
        /// </summary>
        private void NewCriteria_Click(object sender, EventArgs e)
        {
            if (List.Type == ConditionType.Plus || List.Type == ConditionType.Div)
            {
                if (ConditionTree.Nodes[0].Nodes.Count > 1)
                {
                    MessageBox.Show("Only 2 criteria's allowed per List.");
                    return;
                }
            }
            else if (List.Type == ConditionType.Not)
            {
                if (ConditionTree.Nodes[0].Nodes.Count == 2)
                {
                    MessageBox.Show("Only 1 criteria allowed per List.");
                    return;
                }
            }

            // Make sure we are only adding to the root condition list
            Child              = new NewCriteriaForm();
            Child.FormClosing += Child_FormClosing;
            Child.Show();
        }
コード例 #7
0
        /// <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();
        }
コード例 #8
0
        /// <summary>
        /// Adding a new Criteria
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void NewCriteria_Click(object sender, EventArgs e)
        {
            TreeNode Node = AwardConditionsTree.SelectedNode;

            // Make sure an award is selected!!!!
            TreeNode AwardNode = AwardTree.SelectedNode;
            if (AwardNode == null || AwardNode.Parent == null)
            {
                MessageBox.Show("Please select an award!");
                return;
            }

            // Is this the root criteria node?
            if (Node == null)
            {
                Child = new NewCriteriaForm();
            }

            // If plus or div, open edit form
            else if (Node.Tag is ConditionList)
            {
                ConditionList List = Node.Tag as ConditionList;
                if (List.Type == ConditionType.Plus || List.Type == ConditionType.Div)
                    Child = new ConditionListForm(Node);
                else
                    Child = new NewCriteriaForm();
            }

            // Base Condition
            else
            {
                Child = new NewCriteriaForm();
            }

            // Show child form
            Child.FormClosing += new FormClosingEventHandler(NewCriteria_Closing);
            Child.Show();
        }
コード例 #9
0
        /// <summary>
        /// Brings up the Criteria Editor for an Award
        /// </summary>
        public void EditCriteria()
        {
            TreeNode Node = AwardConditionsTree.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 (Node.Parent == null && Node.Nodes.Count != 0)
                return;

            // Get our selected award, and set our criteria Node
            TreeNode N = AwardTree.SelectedNode;
            IAward A = AwardCache.GetAward(N.Name);
            this.Node = Node;

            // 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)
            {
                // Delay tree redraw
                AwardConditionsTree.BeginUpdate();

                // Set awards new conditions from the tree node tagged conditions
                A.SetCondition(MedalDataParser.ParseNodeConditions(AwardConditionsTree.Nodes[0]));

                // Clear all current Nodes
                AwardConditionsTree.Nodes.Clear();

                // Reparse conditions
                AwardConditionsTree.Nodes.Add(A.ToTree());

                // Conditions tree's are to be expanded at all times
                AwardConditionsTree.ExpandAll();
                AwardConditionsTree.EndUpdate();
            }
        }
コード例 #10
0
        /// <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();
            }
        }
コード例 #11
0
        /// <summary>
        /// New Criteria menu item click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void NewCriteria_Click(object sender, EventArgs e)
        {
            if (List.Type == ConditionType.Plus || List.Type == ConditionType.Div)
            {
                if (ConditionTree.Nodes[0].Nodes.Count > 1)
                {
                    MessageBox.Show("Only 2 criteria's allowed per List.");
                    return;
                }
            }
            else if (List.Type == ConditionType.Not)
            {
                if (ConditionTree.Nodes[0].Nodes.Count == 2)
                {
                    MessageBox.Show("Only 1 criteria allowed per List.");
                    return;
                }
            }

            // Make sure we are only adding to the root condition list

            Child = new NewCriteriaForm();
            Child.FormClosing += new FormClosingEventHandler(Child_FormClosing);
            Child.Show();
        }
コード例 #12
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();
            }
        }