Changeset 18115 for branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/ConstantView.cs
- Timestamp:
- 12/13/21 17:49:34 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3140_NumberSymbol/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/ConstantView.cs
r18100 r18115 27 27 28 28 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views { 29 [View(" NumberView")]30 [Content(typeof( Number), true)]29 [View("Constant View")] 30 [Content(typeof(Constant), true)] 31 31 public partial class ConstantView : SymbolView { 32 public new NumberContent {33 get { return ( Number)base.Content; }32 public new Constant Content { 33 get { return (Constant)base.Content; } 34 34 set { base.Content = value; } 35 35 } … … 43 43 Content.Changed += new EventHandler(Content_Changed); 44 44 } 45 45 46 46 protected override void DeregisterContentEvents() { 47 47 base.DeregisterContentEvents(); … … 56 56 protected override void SetEnabledStateOfControls() { 57 57 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; 66 60 } 67 61 … … 73 67 74 68 #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); 80 74 } 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"); 111 76 } 112 77 } … … 116 81 private void UpdateControl() { 117 82 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; 123 84 } 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"); 128 86 } 129 87 SetEnabledStateOfControls();
Note: See TracChangeset
for help on using the changeset viewer.