protected void changeVariable(Variable variable)
 {
     backupDimensionedParameter.parameter.variable = dimensionedParameter.parameter.variable;
     dimensionedParameter.parameter.variable = variable;
     if (updateGUI != null)
         updateGUI(this, null);
 }
        public void setVariable(Variable var)
        {
            if (this.variable == var)
                return; // if the variable is already set appropriately,
                        // do nothing and return immediately

            this.variable = var;
            if (this.variable.ListDriven) {
                this.listSelector.Visible = true;
                this.listSelector.SelectedIndex = this.variable.ListNumber;
            }
            else
                this.listSelector.Visible = false;

            if (!variable.DerivedVariable && !variable.PermanentVariable)
            {
                this.valueSelector.Value = (decimal)this.variable.VariableValue;
            }

            this.textBox1.Text = variable.VariableName;

            this.derivedCheckBox.Checked = var.DerivedVariable;
            this.formulaTextBox.Text = var.VariableFormula;

            updateLayout();
        }
        public VariablePreviewEditor(Variable variable)
            : this()
        {
            this.variable = variable;
            this.variableName.Text = variable.VariableName;
            refreshCurrentValue(variable);
            this.nextValue.Value = (decimal) variable.VariableValue;
            if ((variable.passThroughVariable!=null) || variable.IsSpecialVariable || variable.ListDriven || variable.DerivedVariable)
            {
                this.nextValue.Enabled = false;
                this.nextValue.Visible = false;
            }

            this.nextValue.ValueChanged += new EventHandler(nextValue_ValueChanged);

            this.clickToChangeButton.Visible = false;
        }
Пример #4
0
 /// <summary>
 /// Sets the parameters manual value, and disables any variables which were in use.
 /// </summary>
 /// <param name="value"></param>
 public void forceToManualValue(double value)
 {
     ManualValue = value;
     variable = null;
 }
 private void refreshCurrentValue(Variable variable)
 {
     this.currentValue.Text = variable.VariableValue.ToString();
 }
 private VariableEditor createAndRegisterNewVariableEditor(Variable var)
 {
     VariableEditor ved = new VariableEditor();
     ved.setVariable(var);
     /*        int x = variableEditorPlaceholder.Location.X;
             int y = variableEditorPlaceholder.Location.Y + variableEditors.Count * (variableEditorPlaceholder.Height + 5);
             ved.Location = new Point(x, y);*/
     ved.variableDeleted += new EventHandler(ved_variableDeleted);
     //      ved.SizeChanged += new EventHandler(ved_SizeChanged);
     ved.valueChanged += new EventHandler(ved_valueChanged);
     variableEditors.Add(ved);
     return ved;
 }
 private void addButton_Click(object sender, EventArgs e)
 {
     Variable var = new Variable();
     var.VariableName = "Var " + (Storage.sequenceData.Variables.Count + 1);
     Storage.sequenceData.Variables.Add(var);
     this.layoutVariables();
 }