Changeset 16634
- Timestamp:
- 02/28/19 17:20:10 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/NamedIntervalsView.cs
r16627 r16634 37 37 38 38 public new NamedIntervals Content { 39 get => (NamedIntervals)base.Content; 40 set => base.Content = value; 39 get => (NamedIntervals)base.Content; 40 set => base.Content = value; 41 41 } 42 42 … … 82 82 dataGridView.Rows.AddRange(rows); 83 83 84 setRowsHeader();84 SetRowsHeader(); 85 85 FillRows(); 86 86 … … 99 99 } 100 100 101 protected void setRowsHeader() {101 protected void SetRowsHeader() { 102 102 for (var i = 0; i < Content.VariableIntervals.Count; ++i) { 103 103 var item = Content.VariableIntervals.ElementAt(i); … … 119 119 var upperBound = e.ColumnIndex == 1 ? double.Parse(dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()) : Content.VariableIntervals[key].UpperBound; 120 120 121 Content.VariableIntervals[key] = new Interval(lowerBound, upperBound); 121 // update if there was a change 122 if (lowerBound != Content.VariableIntervals[key].LowerBound || 123 upperBound != Content.VariableIntervals[key].UpperBound) 124 Content.VariableIntervals[key] = new Interval(lowerBound, upperBound); 122 125 } 123 126 124 127 private void dataGridView_CellValidating(object sender, DataGridViewCellValidatingEventArgs e) { 125 if (dataGridView.Rows[e.RowIndex].IsNewRow) {126 return;127 }128 // DISABLED VALIDATION OF ENTRIES 129 // because it leads to problems when updating the table 130 // we can assume it's the users fault if he or she enters incorrect values 128 131 129 if (!double.TryParse(e.FormattedValue.ToString(), out var value)) { 130 e.Cancel = true; 131 dataGridView.Rows[e.RowIndex].ErrorText = "Value must be a double value."; 132 } else { 133 if (e.ColumnIndex == 0 && value > double.Parse(dataGridView.Rows[e.RowIndex].Cells[1].Value.ToString()) || 134 e.ColumnIndex == 1 && value < double.Parse(dataGridView.Rows[e.RowIndex].Cells[0].Value.ToString())) { 135 e.Cancel = true; 136 dataGridView.Rows[e.RowIndex].ErrorText = "Lower Bound of Interval must be smaller than Upper Bound."; 137 } 138 } 132 // if (dataGridView.Rows[e.RowIndex].IsNewRow) { 133 // return; 134 // } 135 // 136 // if (!double.TryParse(e.FormattedValue.ToString(), out var value)) { 137 // e.Cancel = true; 138 // dataGridView.Rows[e.RowIndex].ErrorText = "Value must be a double value."; 139 // } else if (string.IsNullOrEmpty(dataGridView.Rows[e.RowIndex].Cells[0].Value.ToString()) || 140 // string.IsNullOrEmpty(dataGridView.Rows[e.RowIndex].Cells[1].Value.ToString())) { 141 // // accept any value if one of the cells is still empty 142 // } else { 143 // var left = double.Parse(dataGridView.Rows[e.RowIndex].Cells[0].Value.ToString()); 144 // var right = double.Parse(dataGridView.Rows[e.RowIndex].Cells[1].Value.ToString()); 145 // if (e.ColumnIndex == 1 && value < left || e.ColumnIndex == 0 && value > right) { 146 // e.Cancel = true; 147 // dataGridView.Rows[e.RowIndex].ErrorText = "Lower bound of interval must be smaller than upper bound."; 148 // } 149 // } 139 150 } 140 151
Note: See TracChangeset
for help on using the changeset viewer.