Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/19/10 03:28:16 (14 years ago)
Author:
swagner
Message:

Restricted types of child operators in MultiOperator (#979)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core.Views/3.3/ItemArrayView.cs

    r3393 r3407  
    3636  [Content(typeof(IItemArray<>), false)]
    3737  public partial class ItemArrayView<T> : AsynchronousContentView where T : class, IItem {
     38    protected TypeSelectorDialog typeSelectorDialog;
     39
    3840    /// <summary>
    3941    /// Gets or sets the scope whose variables to represent visually.
     
    128130
    129131    protected virtual T CreateItem() {
    130       try {
    131         return (T)Activator.CreateInstance(typeof(T));
    132       }
    133       catch (Exception ex) {
    134         Auxiliary.ShowErrorMessageBox(ex);
    135         return null;
    136       }
     132      if (typeSelectorDialog == null) {
     133        typeSelectorDialog = new TypeSelectorDialog();
     134        typeSelectorDialog.Caption = "Select Item";
     135        typeSelectorDialog.TypeSelector.Caption = "Available Items";
     136        typeSelectorDialog.TypeSelector.Configure(typeof(T), false, false);
     137      }
     138
     139      if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) {
     140        try {
     141          return (T)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType();
     142        }
     143        catch (Exception ex) {
     144          Auxiliary.ShowErrorMessageBox(ex);
     145        }
     146      }
     147      return null;
    137148    }
    138149    protected virtual ListViewItem CreateListViewItem(T item) {
Note: See TracChangeset for help on using the changeset viewer.