Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/13/21 17:49:34 (2 years ago)
Author:
gkronber
Message:

#3140: made several more changes for the constant -> number branch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/ConstantView.cs

    r18100 r18115  
    2727
    2828namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
    29   [View("Number View")]
    30   [Content(typeof(Number), true)]
     29  [View("Constant View")]
     30  [Content(typeof(Constant), true)]
    3131  public partial class ConstantView : SymbolView {
    32     public new Number Content {
    33       get { return (Number)base.Content; }
     32    public new Constant Content {
     33      get { return (Constant)base.Content; }
    3434      set { base.Content = value; }
    3535    }
     
    4343      Content.Changed += new EventHandler(Content_Changed);
    4444    }
    45 
     45   
    4646    protected override void DeregisterContentEvents() {
    4747      base.DeregisterContentEvents();
     
    5656    protected override void SetEnabledStateOfControls() {
    5757      base.SetEnabledStateOfControls();
    58       minValueTextBox.Enabled = Content != null;
    59       minValueTextBox.ReadOnly = ReadOnly;
    60       maxValueTextBox.Enabled = Content != null;
    61       maxValueTextBox.ReadOnly = ReadOnly;
    62       additiveChangeSigmaTextBox.Enabled = Content != null;
    63       additiveChangeSigmaTextBox.ReadOnly = ReadOnly;
    64       multiplicativeChangeSigmaTextBox.Enabled = Content != null;
    65       multiplicativeChangeSigmaTextBox.ReadOnly = ReadOnly;
     58      valueTextBox.Enabled = Content != null;
     59      valueTextBox.ReadOnly = ReadOnly;
    6660    }
    6761
     
    7367
    7468    #region control event handlers
    75     private void minValueTextBox_TextChanged(object sender, EventArgs e) {
    76       double min;
    77       if (double.TryParse(minValueTextBox.Text, out min)) {
    78         Content.MinValue = min;
    79         errorProvider.SetError(minValueTextBox, string.Empty);
     69    private void valueTextBox_TextChanged(object sender, EventArgs e) {
     70      double val;
     71      if (double.TryParse(valueTextBox.Text, out val)) {
     72        Content.Value = val;
     73        errorProvider.SetError(valueTextBox, string.Empty);
    8074      } else {
    81         errorProvider.SetError(minValueTextBox, "Invalid value");
    82       }
    83     }
    84     private void maxValueTextBox_TextChanged(object sender, EventArgs e) {
    85       double max;
    86       if (double.TryParse(maxValueTextBox.Text, out max)) {
    87         Content.MaxValue = max;
    88         errorProvider.SetError(maxValueTextBox, string.Empty);
    89       } else {
    90         errorProvider.SetError(maxValueTextBox, "Invalid value");
    91       }
    92     }
    93 
    94     private void additiveChangeSigmaTextBox_TextChanged(object sender, EventArgs e) {
    95       double sigma;
    96       if (double.TryParse(additiveChangeSigmaTextBox.Text, out sigma) && sigma >= 0.0) {
    97         Content.ManipulatorSigma = sigma;
    98         errorProvider.SetError(additiveChangeSigmaTextBox, string.Empty);
    99       } else {
    100         errorProvider.SetError(additiveChangeSigmaTextBox, "Invalid value");
    101       }
    102     }
    103 
    104     private void multiplicativeChangeSigmaTextBox_TextChanged(object sender, EventArgs e) {
    105       double sigma;
    106       if (double.TryParse(multiplicativeChangeSigmaTextBox.Text, out sigma) && sigma >= 0.0) {
    107         Content.MultiplicativeManipulatorSigma = sigma;
    108         errorProvider.SetError(multiplicativeChangeSigmaTextBox, string.Empty);
    109       } else {
    110         errorProvider.SetError(multiplicativeChangeSigmaTextBox, "Invalid value");
     75        errorProvider.SetError(valueTextBox, "Invalid value");
    11176      }
    11277    }
     
    11681    private void UpdateControl() {
    11782      if (Content == null) {
    118         minValueTextBox.Text = string.Empty;
    119         maxValueTextBox.Text = string.Empty;
    120         minValueTextBox.Text = string.Empty;
    121         multiplicativeChangeSigmaTextBox.Text = string.Empty;
    122         additiveChangeSigmaTextBox.Text = string.Empty;
     83        valueTextBox.Text = string.Empty;
    12384      } else {
    124         minValueTextBox.Text = Content.MinValue.ToString();
    125         maxValueTextBox.Text = Content.MaxValue.ToString();
    126         additiveChangeSigmaTextBox.Text = Content.ManipulatorSigma.ToString();
    127         multiplicativeChangeSigmaTextBox.Text = Content.MultiplicativeManipulatorSigma.ToString();
     85        valueTextBox.Text = Content.Value.ToString("g17");
    12886      }
    12987      SetEnabledStateOfControls();
Note: See TracChangeset for help on using the changeset viewer.