Changeset 2438 for branches/Mainform refactoring/HeuristicLab.MainForm
- Timestamp:
- 10/18/09 01:18:23 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Mainform refactoring/HeuristicLab.MainForm/3.2/MainFormManager.cs
r2437 r2438 97 97 98 98 public static Type GetDefaultViewType(Type viewableType) { 99 if (!defaultViews.ContainsKey(viewableType)) { 99 if (defaultViews.ContainsKey(viewableType)) 100 return defaultViews[viewableType]; 101 else { 100 102 List<Type> temp = defaultViews.Keys.Where(x => x.IsAssignableFrom(viewableType)).ToList(); 103 //no assignable type found 101 104 if (temp.Count == 0) 102 105 return null; 106 //only one assignable type found => return this one 103 107 else if (temp.Count == 1) 104 108 return defaultViews[temp[0]]; 109 //more assignable types found => sort the types according to their assignable types 110 //and return most specific type => except there is a conflict 105 111 else { 106 112 temp.Sort(delegate(Type t1, Type t2) { … … 110 116 } 111 117 ); 112 if (!temp[0].IsAssignableFrom(temp[1]) && !temp[1].IsAssignableFrom(temp[0])) 118 if (temp[1].IsAssignableFrom(temp[0])) 119 return defaultViews[temp[0]]; 120 else 113 121 throw new Exception("Could not determine which is the default view for type " + viewableType.ToString() + "."); 114 else115 return defaultViews[temp[0]];116 122 } 117 } else 118 return defaultViews[viewableType]; 123 } 119 124 } 120 125
Note: See TracChangeset
for help on using the changeset viewer.