Changeset 12267
- Timestamp:
- 03/30/15 13:26:22 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/EnumValue in CreateExperiment/HeuristicLab.Optimizer/3.3/CreateExperimentDialog.cs
r12254 r12267 877 877 if (multipleChoiceParameters.Any()) { 878 878 foreach (var m in mcEnumerator.Current) { 879 dynamic variantParam = variant.Parameters[m.Key.Name]; 880 if (m.Value == optionalNullChoice) { 881 variantParam.Value = null; 882 variant.Name += m.Key.Name + "=null, "; 883 continue; 884 } 885 var variantEnumerator = ((IEnumerable<object>)variantParam.ValidValues).GetEnumerator(); 886 var originalEnumerator = ((IEnumerable<object>)((dynamic)m.Key).ValidValues).GetEnumerator(); 887 while (variantEnumerator.MoveNext() && originalEnumerator.MoveNext()) { 888 if (m.Value == (IItem)originalEnumerator.Current) { 889 variantParam.Value = (dynamic)variantEnumerator.Current; 890 if (m.Value is INamedItem) 891 variant.Name += m.Key.Name + "=" + ((INamedItem)m.Value).Name + ", "; 892 else variant.Name += m.Key.Name + "=" + m.Value.ToString() + ", "; 893 break; 879 if (m.Key.Value != null && m.Key.Value.GetType().IsGenericType 880 && typeof(EnumValue<>).IsAssignableFrom(m.Key.Value.GetType().GetGenericTypeDefinition())) { 881 var valueParam = (IValueParameter)variant.Parameters[m.Key.Name]; 882 valueParam.Value = m.Value; 883 variant.Name += m.Key.Name + "=" + m.Value + ", "; 884 } else { 885 dynamic variantParam = variant.Parameters[m.Key.Name]; 886 if (m.Value == optionalNullChoice) { 887 variantParam.Value = null; 888 variant.Name += m.Key.Name + "=null, "; 889 continue; 890 } 891 var variantEnumerator = ((IEnumerable<object>)variantParam.ValidValues).GetEnumerator(); 892 var originalEnumerator = ((IEnumerable<object>)((dynamic)m.Key).ValidValues).GetEnumerator(); 893 while (variantEnumerator.MoveNext() && originalEnumerator.MoveNext()) { 894 if (m.Value == (IItem)originalEnumerator.Current) { 895 variantParam.Value = (dynamic)variantEnumerator.Current; 896 if (m.Value is INamedItem) 897 variant.Name += m.Key.Name + "=" + ((INamedItem)m.Value).Name + ", "; 898 else variant.Name += m.Key.Name + "=" + m.Value.ToString() + ", "; 899 break; 900 } 894 901 } 895 902 }
Note: See TracChangeset
for help on using the changeset viewer.