- Timestamp:
- 03/23/20 16:40:16 (5 years ago)
- Location:
- branches/3026_IntegrationIntoSymSpace
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/JsonItemMultiValueControl.cs
r17484 r17485 182 182 #region Validation 183 183 private void textBoxRows_Validating(object sender, CancelEventArgs e) { 184 if (string.IsNullOrWhiteSpace(textBoxRows.Text)) { 185 errorProvider.SetError(textBoxRows, "'Rows' must not be empty."); 186 e.Cancel = true; 187 } else if (!int.TryParse(textBoxRows.Text, out int r)) { 188 errorProvider.SetError(textBoxRows, "Value of 'Rows' must be an integer."); 189 e.Cancel = true; 190 } else if (r == 0) { 191 errorProvider.SetError(textBoxRows, "Value of 'Rows' must be an integer larger than 0."); 192 e.Cancel = true; 193 } else { 184 if (textBoxRows.ReadOnly) { 194 185 errorProvider.SetError(textBoxRows, null); 186 } else { 187 if (string.IsNullOrWhiteSpace(textBoxRows.Text)) { 188 errorProvider.SetError(textBoxRows, "'Rows' must not be empty."); 189 e.Cancel = true; 190 } else if (!int.TryParse(textBoxRows.Text, out int r)) { 191 errorProvider.SetError(textBoxRows, "Value of 'Rows' must be an integer."); 192 e.Cancel = true; 193 } else if (r == 0) { 194 errorProvider.SetError(textBoxRows, "Value of 'Rows' must be an integer larger than 0."); 195 e.Cancel = true; 196 } else { 197 errorProvider.SetError(textBoxRows, null); 198 } 195 199 } 196 200 } 197 201 198 202 private void textBoxColumns_Validating(object sender, CancelEventArgs e) { 199 if (string.IsNullOrWhiteSpace(textBoxColumns.Text)) { 200 errorProvider.SetError(textBoxColumns, "'Columns' must not be empty."); 201 e.Cancel = true; 202 } else if (!int.TryParse(textBoxColumns.Text, out int r)) { 203 errorProvider.SetError(textBoxColumns, "Value of 'Columns' must be an integer."); 204 e.Cancel = true; 205 } else if (r == 0) { 206 errorProvider.SetError(textBoxColumns, "Value of 'Columns' must be an integer larger than 0."); 207 e.Cancel = true; 208 } else { 203 if (textBoxColumns.ReadOnly) { 209 204 errorProvider.SetError(textBoxColumns, null); 205 } else { 206 if (string.IsNullOrWhiteSpace(textBoxColumns.Text)) { 207 errorProvider.SetError(textBoxColumns, "'Columns' must not be empty."); 208 e.Cancel = true; 209 } else if (!int.TryParse(textBoxColumns.Text, out int r)) { 210 errorProvider.SetError(textBoxColumns, "Value of 'Columns' must be an integer."); 211 e.Cancel = true; 212 } else if (r == 0) { 213 errorProvider.SetError(textBoxColumns, "Value of 'Columns' must be an integer larger than 0."); 214 e.Cancel = true; 215 } else { 216 errorProvider.SetError(textBoxColumns, null); 217 } 210 218 } 211 219 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ConstrainedValueParameterConverter.cs
r17483 r17485 21 21 if (parameter.ActualValue != null && parameter.ActualValue is IParameterizedItem && cdata.Children != null) { 22 22 foreach(var child in cdata.Children) { 23 if(child.Name == cdata.Value || child.Path.EndsWith(cdata.Value) )23 if(child.Name == cdata.Value || child.Path.EndsWith(cdata.Value) || child.Name == parameter.ActualValue.ItemName) 24 24 root.Inject(parameter.ActualValue, child, root); 25 25 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Models/JsonItem.cs
r17481 r17485 42 42 43 43 public ValidationResult Validate() { 44 IEnumerable<string> errors = Enumerable.Empty<string>();44 List<string> errors = new List<string>(); 45 45 bool success = true; 46 46 foreach(var x in Root) { 47 var res = ((JsonItem)x).Validate(); 48 //if one success is false -> whole validation is false 49 success = success && res.Success; 50 errors.Concat(res.Errors); 47 JsonItem item = x as JsonItem; 48 if(item.Active) { 49 var res = ((JsonItem)x).Validate(); 50 //if one success is false -> whole validation is false 51 success = success && res.Success; 52 errors.AddRange(res.Errors); 53 } 51 54 } 52 55 return new ValidationResult(success, errors);
Note: See TracChangeset
for help on using the changeset viewer.