Changeset 7538 for branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views/3.3/ProblemView.cs
- Timestamp:
- 03/01/12 15:15:22 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views/3.3/ProblemView.cs
r7523 r7538 63 63 if (problemInstanceProviderComboBox.SelectedIndex >= 0) { 64 64 var provider = (IProblemInstanceProvider)problemInstanceProviderComboBox.SelectedItem; 65 provider.SetConsumer((IProblemInstanceConsumer)Content); 65 var genericType = provider.GetType().GetInterfaces().Single(x => x.IsGenericType && x.GetGenericTypeDefinition() == typeof(IProblemInstanceProvider<>)).GetGenericArguments().First(); 66 this.GetType().GetMethod("SetConsumable").MakeGenericMethod(genericType).Invoke(this, new object[] { provider, Content }); 66 67 problemInstanceProviderViewHost.Content = provider; 67 68 } 69 } 70 71 /// <summary> 72 /// Do not change method name without changing the string reference above 73 /// </summary> 74 private void SetConsumable<T>(IProblemInstanceProvider<T> producer, IConsumable<T> consumer) { 75 producer.Consumer = consumer; 68 76 } 69 77 … … 77 85 var consumerTypes = Content.GetType().GetInterfaces() 78 86 .Where(x => x.IsGenericType 79 && typeof(IProblemInstanceConsumer).IsAssignableFrom(x));87 && x.GetGenericTypeDefinition() == typeof(IConsumable<>)); 80 88 81 89 if (consumerTypes.Any()) {
Note: See TracChangeset
for help on using the changeset viewer.