コード例 #1
0
        public void ShowConditionInformation()
        {
            if (Instruction.Condition == null)
            {
                Node = null;
                buttonCondition.Text = "Create";
                treeViewCondition.Nodes.Clear();
            }
            else
            {
                buttonCondition.Text = "Remove";
                treeViewCondition.Nodes.Clear();
                treeViewCondition.Nodes.Add(Instruction.Condition.GetTreeNode());
                treeViewCondition.ExpandAll();
            }

            if (Node == null)
            {
                comboBoxTypeCondition.Enabled = false;
                comboBoxParameter.Enabled = false;
                comboBoxOperator.Enabled = false;
                numericUpDownValue2.Enabled = false;
                buttonAdd.Enabled = false;
                buttonDelete.Enabled = false;
            }
            else
            {
                var condition = Node.Condition;

                comboBoxTypeCondition.Enabled = true;
                comboBoxTypeCondition.Text = condition.Type.ToString();

                buttonAdd.Enabled = condition.Type != TypeCondition.Unique;
                buttonDelete.Enabled = true;

                if (condition.Type == TypeCondition.Unique)
                {
                    comboBoxParameter.Enabled = true;
                    comboBoxParameter.Text = condition.Comparision.Parameter.ToString();

                    comboBoxOperator.Enabled = true;
                    switch (condition.Comparision.Operator)
                    {
                        case TypeOperator.GreaterEqual:
                            comboBoxOperator.Text = ">=";
                            break;
                        case TypeOperator.Greater:
                            comboBoxOperator.Text = ">";
                            break;
                        case TypeOperator.Equal:
                            comboBoxOperator.Text = "==";
                            break;
                        case TypeOperator.Lower:
                            comboBoxOperator.Text = "<";
                            break;
                        case TypeOperator.LowerEqual:
                            comboBoxOperator.Text = "<=";
                            break;
                        case TypeOperator.NotEqual:
                            comboBoxOperator.Text = "!=";
                            break;
                    }

                    numericUpDownValue2.Enabled = true;
                    numericUpDownValue2.Value = (decimal)condition.Comparision.Value;
                }
                else
                {
                    comboBoxParameter.Enabled = false;
                    comboBoxOperator.Enabled = false;
                    numericUpDownValue2.Enabled = false;
                }
            }
        }
コード例 #2
0
 private void treeViewCondition_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
 {
     Node = (TreeNodePlus)e.Node;
     ShowConditionInformation();
 }
コード例 #3
0
 private void buttonDelete_Click(object sender, EventArgs e)
 {
     var parent = Node.Parent != null ? ((TreeNodePlus)Node.Parent).Condition : null;
     if (parent != null)
     {
         parent.Children.Remove(Node.Condition);
         if (parent.Children.Count == 0)
         {
             parent.Type = TypeCondition.Unique;
             parent.Comparision = new Comparison();
         }
     }
     else
     {
         Instruction.Condition = null;
     }
     Node = null;
     ShowConditionInformation();
 }