Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2833


Ignore:
Timestamp:
02/19/10 03:03:41 (15 years ago)
Author:
swagner
Message:

Operator architecture refactoring (#95)

  • added missing null checks in constructors of item collections and Variable
  • set AllowDrop property to true in VariableView
Location:
trunk/sources
Files:
7 edited

Legend:

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

    r2796 r2833  
    108108      // valuePanel
    109109      //
     110      this.valuePanel.AllowDrop = true;
    110111      this.valuePanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    111112                  | System.Windows.Forms.AnchorStyles.Left)
  • trunk/sources/HeuristicLab.Core/3.3/ItemArray.cs

    r2830 r2833  
    5858    public ItemArray(T[] array) : base(array) {
    5959      foreach (T item in this)
    60         item.Changed += new ChangedEventHandler(Item_Changed);
     60        if (item != null) item.Changed += new ChangedEventHandler(Item_Changed);
    6161    }
    6262    public ItemArray(IEnumerable<T> collection) : base(collection) {
    6363      foreach (T item in this)
    64         item.Changed += new ChangedEventHandler(Item_Changed);
     64        if (item != null) item.Changed += new ChangedEventHandler(Item_Changed);
    6565    }
    6666
  • trunk/sources/HeuristicLab.Core/3.3/ItemCollection.cs

    r2830 r2833  
    5959    public ItemCollection(IEnumerable<T> collection) : base(collection) {
    6060      foreach (T item in this)
    61         item.Changed += new ChangedEventHandler(Item_Changed);
     61        if (item != null) item.Changed += new ChangedEventHandler(Item_Changed);
    6262    }
    6363
  • trunk/sources/HeuristicLab.Core/3.3/ItemList.cs

    r2830 r2833  
    5959    public ItemList(IEnumerable<T> collection) : base(collection) {
    6060      foreach (T item in this)
    61         item.Changed += new ChangedEventHandler(Item_Changed);
     61        if (item != null) item.Changed += new ChangedEventHandler(Item_Changed);
    6262    }
    6363
  • trunk/sources/HeuristicLab.Core/3.3/ItemSet.cs

    r2830 r2833  
    5858    public ItemSet(IEnumerable<T> collection) : base(collection) {
    5959      foreach (T item in this)
    60         item.Changed += new ChangedEventHandler(Item_Changed);
     60        if (item != null) item.Changed += new ChangedEventHandler(Item_Changed);
    6161    }
    6262
  • trunk/sources/HeuristicLab.Core/3.3/NamedItemCollection.cs

    r2830 r2833  
    105105    private void RegisterItemEvents(IEnumerable<T> items) {
    106106      foreach (T item in items) {
    107         item.NameChanging += new EventHandler<CancelEventArgs<string>>(Item_NameChanging);
    108         item.NameChanged += new EventHandler(Item_NameChanged);
    109         item.Changed += new ChangedEventHandler(Item_Changed);
     107        if (item != null) {
     108          item.NameChanging += new EventHandler<CancelEventArgs<string>>(Item_NameChanging);
     109          item.NameChanged += new EventHandler(Item_NameChanged);
     110          item.Changed += new ChangedEventHandler(Item_Changed);
     111        }
    110112      }
    111113    }
    112114    private void DeregisterItemEvents(IEnumerable<T> items) {
    113115      foreach (T item in items) {
    114         item.NameChanging -= new EventHandler<CancelEventArgs<string>>(Item_NameChanging);
    115         item.NameChanged -= new EventHandler(Item_NameChanged);
    116         item.Changed -= new ChangedEventHandler(Item_Changed);
     116        if (item != null) {
     117          item.NameChanging -= new EventHandler<CancelEventArgs<string>>(Item_NameChanging);
     118          item.NameChanged -= new EventHandler(Item_NameChanged);
     119          item.Changed -= new ChangedEventHandler(Item_Changed);
     120        }
    117121      }
    118122    }
  • trunk/sources/HeuristicLab.Core/3.3/Variable.cs

    r2830 r2833  
    7272      : base(name) {
    7373      this.value = value;
    74       this.value.Changed += new ChangedEventHandler(Value_Changed);
     74      if (this.value != null) this.value.Changed += new ChangedEventHandler(Value_Changed);
    7575    }
    7676    public Variable(string name, string description, IItem value)
    7777      : base(name, description) {
    7878      this.value = value;
    79       this.value.Changed += new ChangedEventHandler(Value_Changed);
     79      if (this.value != null) this.value.Changed += new ChangedEventHandler(Value_Changed);
    8080    }
    8181
Note: See TracChangeset for help on using the changeset viewer.