Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/04/11 02:09:55 (14 years ago)
Author:
cneumuel
Message:

#1361 fixed deregistration of events on parameter values

Location:
trunk/sources/HeuristicLab.Parameters/3.3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Parameters/3.3/OptionalConstrainedValueParameter.cs

    r4722 r5206  
    5454        if (value != this.value) {
    5555          if ((value != null) && !validValues.Contains(value)) throw new ArgumentException("Invalid value.");
     56          OnValueChanging();
    5657          DeregisterValueEvents();
    5758          this.value = value;
     
    205206    }
    206207
     208    public event EventHandler ValueChanging;
     209    protected virtual void OnValueChanging() {
     210      EventHandler handler = ValueChanging;
     211      if (handler != null) handler(this, EventArgs.Empty);
     212    }
    207213    public event EventHandler ValueChanged;
    208214    protected virtual void OnValueChanged() {
  • trunk/sources/HeuristicLab.Parameters/3.3/OptionalValueParameter.cs

    r4825 r5206  
    4646      set {
    4747        if (value != this.value) {
     48          OnValueChanging();
    4849          DeregisterValueEvents();
    4950          this.value = value;
     
    187188      ((IValueParameter)this).Value = value;
    188189    }
    189 
     190   
     191    public event EventHandler ValueChanging;
     192    protected virtual void OnValueChanging() {
     193      EventHandler handler = ValueChanging;
     194      if (handler != null) handler(this, EventArgs.Empty);
     195    }
    190196    public event EventHandler ValueChanged;
    191197    protected virtual void OnValueChanged() {
  • trunk/sources/HeuristicLab.Parameters/3.3/ValueLookupParameter.cs

    r4722 r5206  
    4646      set {
    4747        if (value != this.value) {
     48          OnValueChanging();
    4849          DeregisterValueEvents();
    4950          this.value = value;
     
    159160    }
    160161
     162    public event EventHandler ValueChanging;
     163    protected virtual void OnValueChanging() {
     164      EventHandler handler = ValueChanging;
     165      if (handler != null) handler(this, EventArgs.Empty);
     166    }
    161167    public event EventHandler ValueChanged;
    162168    protected virtual void OnValueChanged() {
Note: See TracChangeset for help on using the changeset viewer.