Changeset 2999
- Timestamp:
- 03/11/10 03:50:29 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core.Views/3.3/TypeSelector.cs
r2953 r2999 128 128 typeNode.ImageIndex = imageList.Images.IndexOfKey(type.FullName); 129 129 } 130 catch (Exception) { 131 } 130 catch (Exception) { } 132 131 } 133 132 typeNode.SelectedImageIndex = typeNode.ImageIndex; … … 199 198 200 199 public virtual object CreateInstanceOfSelectedType(params object[] args) { 201 if (SelectedType != null) { 202 try { 200 if (SelectedType == null) 201 throw new InvalidOperationException("No type selected."); 202 else 203 203 return Activator.CreateInstance(SelectedType, args); 204 } catch(Exception) { }205 }206 return null;207 204 } 208 205 … … 248 245 TreeNode node = (TreeNode)e.Item; 249 246 Type type = node.Tag as Type; 250 if (type != null) { 251 try { 252 object o = Activator.CreateInstance(type); 253 DataObject data = new DataObject(); 254 data.SetData("Type", type); 255 data.SetData("Value", o); 256 DoDragDrop(data, DragDropEffects.Copy); 257 } catch (Exception) { 258 } 247 if ((type != null) && (!type.IsInterface) && (!type.IsAbstract) && (!type.HasElementType) && (!type.ContainsGenericParameters)) { 248 object o = Activator.CreateInstance(type); 249 DataObject data = new DataObject(); 250 data.SetData("Type", type); 251 data.SetData("Value", o); 252 DoDragDrop(data, DragDropEffects.Copy); 259 253 } 260 254 }
Note: See TracChangeset
for help on using the changeset viewer.