Changeset 42
- Timestamp:
- 03/05/08 02:52:41 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core/ChooseItemDialog.cs
r2 r42 105 105 Type type = (Type)treeView.SelectedNode.Tag; 106 106 107 if (type.ContainsGenericParameters) { 108 type = type.GetGenericTypeDefinition(); 109 Type[] args = new Type[type.GetGenericArguments().Length]; 110 ChooseTypeDialog dialog = new ChooseTypeDialog(); 111 for (int i = 0; i < args.Length; i++) { 112 dialog.Caption = "Choose type of generic parameter " + (i + 1).ToString(); 113 if (dialog.ShowDialog(this) == DialogResult.OK) 114 args[i] = dialog.Type; 115 else 116 args[i] = null; 117 } 118 dialog.Dispose(); 119 type = type.MakeGenericType(args); 120 } 121 107 122 myItem = (IItem)Activator.CreateInstance(type); 108 123 this.DialogResult = DialogResult.OK; … … 114 129 if ((treeView.SelectedNode != null) && (treeView.SelectedNode.Tag != null)) { 115 130 Type type = (Type)treeView.SelectedNode.Tag; 131 132 if (type.ContainsGenericParameters) { 133 type = type.GetGenericTypeDefinition(); 134 Type[] args = new Type[type.GetGenericArguments().Length]; 135 ChooseTypeDialog dialog = new ChooseTypeDialog(); 136 for (int i = 0; i < args.Length; i++) { 137 dialog.Caption = "Choose type of generic parameter " + (i + 1).ToString(); 138 if (dialog.ShowDialog(this) == DialogResult.OK) 139 args[i] = dialog.Type; 140 else 141 args[i] = null; 142 } 143 dialog.Dispose(); 144 type = type.MakeGenericType(args); 145 } 146 116 147 myItem = (IItem)Activator.CreateInstance(type); 117 148 this.DialogResult = DialogResult.OK; … … 130 161 if (treeView.Nodes.Count == 1) { 131 162 Type type = (Type)treeView.Nodes[0].Tag; 132 myItem = (IItem)Activator.CreateInstance(type); 133 this.DialogResult = DialogResult.OK; 134 this.Close(); 163 if (!type.ContainsGenericParameters) { 164 myItem = (IItem)Activator.CreateInstance(type); 165 this.DialogResult = DialogResult.OK; 166 this.Close(); 167 } 135 168 } 136 169 }
Note: See TracChangeset
for help on using the changeset viewer.