- Timestamp:
- 04/19/10 03:28:16 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core.Views/3.3/ItemCollectionView.cs
r3393 r3407 33 33 [Content(typeof(IItemCollection<>), false)] 34 34 public partial class ItemCollectionView<T> : AsynchronousContentView where T : class, IItem { 35 protected TypeSelectorDialog typeSelectorDialog; 36 35 37 public new IItemCollection<T> Content { 36 38 get { return (IItemCollection<T>)base.Content; } … … 103 105 104 106 protected virtual T CreateItem() { 105 try { 106 return (T)Activator.CreateInstance(typeof(T)); 107 } catch(Exception ex) { 108 Auxiliary.ShowErrorMessageBox(ex); 109 return null; 110 } 107 if (typeSelectorDialog == null) { 108 typeSelectorDialog = new TypeSelectorDialog(); 109 typeSelectorDialog.Caption = "Select Item"; 110 typeSelectorDialog.TypeSelector.Caption = "Available Items"; 111 typeSelectorDialog.TypeSelector.Configure(typeof(T), false, false); 112 } 113 114 if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) { 115 try { 116 return (T)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType(); 117 } 118 catch (Exception ex) { 119 Auxiliary.ShowErrorMessageBox(ex); 120 } 121 } 122 return null; 111 123 } 112 124 protected virtual ListViewItem CreateListViewItem(T item) {
Note: See TracChangeset
for help on using the changeset viewer.