Changeset 16545
- Timestamp:
- 01/22/19 11:59:54 (6 years ago)
- Location:
- branches/2971_named_intervals
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/NamedIntervalsView.cs
r16544 r16545 65 65 base.SetEnabledStateOfControls(); 66 66 dataGridView.Enabled = Content != null; 67 dataGridView.ReadOnly = ReadOnly;67 //dataGridView.ReadOnly = ReadOnly; 68 68 } 69 69 … … 108 108 109 109 private void dataGridView_CellValueChanged(object sender, DataGridViewCellEventArgs e) { 110 110 var key = dataGridView.Rows[e.RowIndex].HeaderCell.Value.ToString(); 111 112 if (e.ColumnIndex < 0 || e.RowIndex < 0) return; 113 114 var lowerBound = e.ColumnIndex == 0 ? double.Parse(dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()) : Content.VariableIntervals[key].LowerBound; 115 var upperBound = e.ColumnIndex == 1 ? double.Parse(dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()) : Content.VariableIntervals[key].UpperBound; 116 117 Content.VariableIntervals[key] = new Interval(lowerBound, upperBound); 111 118 } 112 119 … … 114 121 double value; 115 122 123 if (dataGridView.Rows[e.RowIndex].IsNewRow) { 124 return; 125 } 126 116 127 if (!double.TryParse(e.FormattedValue.ToString(), out value)) { 117 dataGridView.Rows[e.RowIndex].ErrorText = "Value has to be a double value";118 128 e.Cancel = true; 119 } else if (string.IsNullOrEmpty(e.FormattedValue.ToString())) {120 dataGridView.Rows[e.RowIndex].ErrorText = "Value has to best";121 e.Cancel = true;122 } else if (double.Parse(dataGridView.Rows[e.RowIndex].Cells[0].Value.ToString()) >123 double.Parse(dataGridView.Rows[e.RowIndex].Cells[1].Value.ToString())) {124 dataGridView.Rows[e.RowIndex].ErrorText = "Lower Bound of Interval has to be smaller than Upper Bound";125 e.Cancel = true;129 dataGridView.Rows[e.RowIndex].ErrorText = "Value must be a double value."; 130 } else { 131 if (e.ColumnIndex == 0 && value > double.Parse(dataGridView.Rows[e.RowIndex].Cells[1].Value.ToString()) || 132 e.ColumnIndex == 1 && value < double.Parse(dataGridView.Rows[e.RowIndex].Cells[0].Value.ToString())) { 133 e.Cancel = true; 134 dataGridView.Rows[e.RowIndex].ErrorText = "Lower Bound of Interval must be smaller than Upper Bound."; 135 } 126 136 } 137 127 138 } 128 139 -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/NamedIntervals.cs
r16544 r16545 26 26 public ObservableDictionary<string, Interval> VariableIntervals => variableIntervals; 27 27 28 public bool ReadOnly { get; } 29 28 30 public bool InsertMany(IEnumerable<KeyValuePair<string, Interval>> entries) { 29 31 if (entries == null) throw new ArgumentNullException("The given dataset is null.");
Note: See TracChangeset
for help on using the changeset viewer.