예제 #1
0
 private void CbResult_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (this.cbResult.SelectedIndex >= 1)
     {
         this.bSave.Enabled = true;
     }
     else
     {
         this.bSave.Enabled = false;
     }
     if (this.cbResult.SelectedIndex == 0)
     {
         NewVariableForm newVariableForm = new NewVariableForm();
         if (DialogResult.OK == newVariableForm.ShowDialog())
         {
             GraphManager.AddVariable(newVariableForm.VariableCreated);
             this.AddVariable(newVariableForm.VariableCreated);
             this.cbResult.SelectedItem = newVariableForm.VariableCreated.Name;
         }
         else
         {
             this.cbResult.Undo();
         }
     }
 }
예제 #2
0
        /// <summary>
        /// Occurs when the time ComboBox is changed from selection
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CbTime_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (this.cbTime.SelectedIndex)
            {
            case 0:
                //Selected "Constant Value"
                this.nudTime.Enabled = true;
                break;

            case 1:
                //Selected "Create New variable"
                this.nudTime.Enabled = false;
                NewVariableForm newVariableForm = new NewVariableForm();
                if (DialogResult.OK == newVariableForm.ShowDialog())
                {
                    //The new variable is created, added to this form and selected with the ComboBox
                    GraphManager.AddVariable(newVariableForm.VariableCreated);
                    this.AddVariable(newVariableForm.VariableCreated);
                    this.cbTime.SelectedItem = newVariableForm.VariableCreated.Name;
                }
                else
                {
                    //If the variable has not been created an Undo of the control is produced to replace the previous value
                    this.cbTime.Undo();
                }
                break;

            default:
                //Selected a variable "xxxx"
                this.nudTime.Enabled = false;
                break;
            }
        }
예제 #3
0
        private void CbOperand_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (this.cbOperand.SelectedIndex)
            {
            case 0:
                this.nudOperandValue.Enabled = true;
                break;

            case 1:
                this.nudOperandValue.Enabled = false;
                NewVariableForm newVariableForm = new NewVariableForm();
                if (DialogResult.OK == newVariableForm.ShowDialog())
                {
                    GraphManager.AddVariable(newVariableForm.VariableCreated);
                    this.AddVariable(newVariableForm.VariableCreated);
                    this.cbOperand.SelectedItem = newVariableForm.VariableCreated.Name;
                }
                else
                {
                    this.cbOperand.Undo();
                }
                break;

            default:
                this.nudOperandValue.Enabled = false;
                break;
            }
        }
예제 #4
0
        private void cbGeneral_SelectedIndexChanged(object sender, EventArgs e)
        {
            MowayComboBox comboBox = (MowayComboBox)sender;

            if (comboBox.SelectedIndex == 1)
            {
                NewVariableForm newVariableForm = new NewVariableForm();
                if (DialogResult.OK == newVariableForm.ShowDialog())
                {
                    GraphManager.AddVariable(newVariableForm.VariableCreated);
                    this.AddVariable(newVariableForm.VariableCreated);
                    comboBox.SelectedItem = newVariableForm.VariableCreated.Name;
                }
                else
                {
                    comboBox.Undo();
                }
            }
        }