Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/05/14 10:39:30 (10 years ago)
Author:
abeham
Message:

#2241: fixed event handling

Location:
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/VariableConditionView.cs

    r11171 r11346  
    5454    private void RegisterVariableNamesViewContentEvents() {
    5555      variableNamesView.Content.ItemsAdded += new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
    56       variableNamesView.Content.ItemsRemoved += new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
     56      variableNamesView.Content.ItemsRemoved += new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Removed);
    5757      variableNamesView.Content.CheckedItemsChanged += new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
    5858      variableNamesView.Content.CollectionReset += new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
     
    6464    private void DeregisterVariableNamesViewContentEvents() {
    6565      variableNamesView.Content.ItemsAdded -= new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
    66       variableNamesView.Content.ItemsRemoved -= new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
     66      variableNamesView.Content.ItemsRemoved -= new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Removed);
    6767      variableNamesView.Content.CheckedItemsChanged -= new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
    6868      variableNamesView.Content.CollectionReset -= new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
     
    153153    }
    154154
     155    private void VariableNames_Removed(object sender, CollectionItemsChangedEventArgs<StringValue> e) {
     156      foreach (var newVar in e.Items)
     157        newVar.ValueChanged -= new EventHandler(Variable_ValueChanged);
     158      UpdateContent();
     159    }
     160
    155161    private void Variable_ValueChanged(object sender, EventArgs e) {
    156162      UpdateContent();
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/VariableView.cs

    r11171 r11346  
    5555    private void RegisterVariableNamesViewContentEvents() {
    5656      variableNamesView.Content.ItemsAdded += new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
    57       variableNamesView.Content.ItemsRemoved += new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
     57      variableNamesView.Content.ItemsRemoved += new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Removed);
    5858      variableNamesView.Content.CheckedItemsChanged += new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
    5959      variableNamesView.Content.CollectionReset += new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
     
    6666    private void DeregisterVariableNamesViewContentEvents() {
    6767      variableNamesView.Content.ItemsAdded -= new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
    68       variableNamesView.Content.ItemsRemoved -= new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
     68      variableNamesView.Content.ItemsRemoved -= new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Removed);
    6969      variableNamesView.Content.CheckedItemsChanged -= new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
    7070      variableNamesView.Content.CollectionReset -= new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
     
    118118    }
    119119
     120    private void VariableNames_Removed(object sender, CollectionItemsChangedEventArgs<StringValue> e) {
     121      foreach (var newVar in e.Items)
     122        newVar.ValueChanged -= new EventHandler(Variable_ValueChanged);
     123      UpdateContent();
     124    }
     125
    120126    private void Variable_ValueChanged(object sender, EventArgs e) {
    121127      UpdateContent();
Note: See TracChangeset for help on using the changeset viewer.