Free cookie consent management tool by TermsFeed Policy Generator

Changeset 11346


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

#2241: fixed event handling

Location:
trunk/sources
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.ScheduleEncoding/3.3/ScheduleEncoding/Job.cs

    r11171 r11346  
    101101    private void RegisterEventHandlers() {
    102102      Tasks.ItemsAdded += TasksOnItemsChanged;
    103       Tasks.ItemsRemoved += TasksOnItemsChanged;
     103      Tasks.ItemsRemoved += TasksOnItemsRemoved;
    104104      Tasks.ItemsReplaced += TasksOnItemsChanged;
    105105      Tasks.CollectionReset += TasksOnItemsChanged;
     
    118118        task.Value.PropertyChanged += TaskOnPropertyChanged;
    119119        task.Value.ToStringChanged += TaskOnToStringChanged;
     120      }
     121      OnTasksChanged();
     122      OnToStringChanged();
     123    }
     124
     125    private void TasksOnItemsRemoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<Task>> e) {
     126      foreach (var task in e.Items) {
     127        task.Value.PropertyChanged -= TaskOnPropertyChanged;
     128        task.Value.ToStringChanged -= TaskOnToStringChanged;
    120129      }
    121130      OnTasksChanged();
  • 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();
  • trunk/sources/HeuristicLab.Problems.Scheduling.Views/3.3/JobShopSchedulingProblemView.cs

    r11171 r11346  
    5252      Content.JobDataParameter.ValueChanged -= JobDataParameterOnValueChanged;
    5353      Content.JobData.ItemsAdded -= JobsOnChanged;
    54       Content.JobData.ItemsRemoved -= JobsOnChanged;
     54      Content.JobData.ItemsRemoved -= JobsOnRemoved;
    5555      Content.JobData.ItemsReplaced -= JobsOnChanged;
    5656      Content.JobData.CollectionReset -= JobsOnChanged;
     
    6464      Content.JobDataParameter.ValueChanged += JobDataParameterOnValueChanged;
    6565      Content.JobData.ItemsAdded += JobsOnChanged;
    66       Content.JobData.ItemsRemoved += JobsOnChanged;
     66      Content.JobData.ItemsRemoved += JobsOnRemoved;
    6767      Content.JobData.ItemsReplaced += JobsOnChanged;
    6868      Content.JobData.CollectionReset += JobsOnChanged;
     
    8080    }
    8181
     82    private void JobsOnRemoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<Job>> e) {
     83      foreach (var job in e.Items)
     84        job.Value.TasksChanged -= JobOnTasksChanged;
     85      FillGanttChart();
     86    }
     87
    8288    private void JobDataParameterOnValueChanged(object sender, EventArgs e) {
    8389      Content.JobData.ItemsAdded += JobsOnChanged;
    84       Content.JobData.ItemsRemoved += JobsOnChanged;
     90      Content.JobData.ItemsRemoved += JobsOnRemoved;
    8591      Content.JobData.ItemsReplaced += JobsOnChanged;
    8692      Content.JobData.CollectionReset += JobsOnChanged;
Note: See TracChangeset for help on using the changeset viewer.