- Timestamp:
- 04/29/10 15:10:17 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.MainForm/3.3/MainFormManager.cs
r3437 r3557 105 105 } 106 106 107 public static bool ViewCanView Object(IContentView view, IContent content) {107 public static bool ViewCanViewContent(IContentView view, IContent content) { 108 108 return ContentAttribute.CanViewType(view.GetType(), content.GetType()); 109 109 } … … 145 145 } 146 146 147 public static IContentView CreateDefaultView(object content) { 148 Type t = GetDefaultViewType(content.GetType()); 147 public static IContentView CreateDefaultView(Type contentType) { 148 CheckForContentType(contentType); 149 Type t = GetDefaultViewType(contentType); 149 150 if (t == null) 150 151 return null; 151 152 152 return (IContentView)Activator.CreateInstance(t , content);153 return (IContentView)Activator.CreateInstance(t); 153 154 } 154 155 public static IContentView CreateView(Type viewType) { 155 if (!typeof(IView).IsAssignableFrom(viewType)) 156 throw new ArgumentException("View can not be created becaues given type " + viewType.ToString() + " is not of type IView."); 156 CheckForContentViewType(viewType); 157 157 if (viewType.IsGenericTypeDefinition) 158 158 throw new ArgumentException("View can not be created becaues given type " + viewType.ToString() + " is a generic type definition."); 159 159 160 160 return (IContentView)Activator.CreateInstance(viewType); 161 }162 public static IContentView CreateView(Type viewType, object content) {163 CheckForContentType(content.GetType());164 CheckForContentViewType(viewType);165 166 Type view = viewType;167 if (view.IsGenericTypeDefinition)168 view = TransformGenericTypeDefinition(view, content.GetType());169 170 return (IContentView)Activator.CreateInstance(view, content);171 161 } 172 162
Note: See TracChangeset
for help on using the changeset viewer.