Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5174


Ignore:
Timestamp:
12/24/10 08:54:31 (14 years ago)
Author:
epitzer
Message:

Correctly show whether operator trace is enabled (#47)

Location:
trunk/sources/HeuristicLab.DebugEngine/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.DebugEngine/3.3/OperatorTrace.cs

    r5121 r5174  
    2020#endregion
    2121
     22using System;
    2223using System.Collections.Generic;
    2324using System.Linq;
     
    3940    [Storable]
    4041    protected bool isEnabled;
     42    #endregion
     43
     44    #region events
     45    public event EventHandler IsEnabledChanged;
     46    protected virtual void OnIsEnabledChanged() {
     47      EventHandler handler = IsEnabledChanged;
     48      if (handler != null)
     49        handler(this, EventArgs.Empty);
     50    }
    4151    #endregion
    4252
     
    134144        if (!isEnabled)
    135145          Reset();
     146        OnIsEnabledChanged();
    136147      }
    137148    }
  • trunk/sources/HeuristicLab.DebugEngine/3.3/OperatorTraceView.cs

    r5146 r5174  
    5151      Content.ItemsRemoved -= Content_CollectionChanged;
    5252      Content.ItemsReplaced -= Content_CollectionChanged;
     53      Content.IsEnabledChanged -= Content_IsEnabledChanged;
    5354      base.DeregisterContentEvents();
    5455    }
     
    6162      Content.ItemsRemoved += Content_CollectionChanged;
    6263      Content.ItemsReplaced += Content_CollectionChanged;
     64      Content.IsEnabledChanged += Content_IsEnabledChanged;
    6365    }
    6466
     
    6971      else
    7072        UpdateOperatorTrace();
     73    }
     74    void Content_IsEnabledChanged(object sender, EventArgs e) {
     75      if (InvokeRequired)
     76        Invoke(new EventHandler(Content_IsEnabledChanged), sender, e);
     77      else
     78        isEnabledCheckbox.Checked = Content.IsEnabled;
    7179    }
    7280    #endregion
     
    103111      if (Content == null) {
    104112        listView.Items.Clear();
     113        isEnabledCheckbox.Checked = false;
    105114      } else {
    106115        UpdateOperatorTrace();
     116        isEnabledCheckbox.Checked = Content.IsEnabled;
    107117      }
    108118    }
     
    122132      }
    123133    }
     134    private void isEnabledCheckbox_CheckedChanged(object sender, EventArgs e) {
     135      if (Content != null)
     136        Content.IsEnabled = isEnabledCheckbox.Checked;
     137    }
    124138    #endregion
    125139
    126     private void isEnabledCheckbox_CheckedChanged(object sender, EventArgs e) {
    127       Content.IsEnabled = isEnabledCheckbox.Checked;
    128     }
     140   
    129141  }
    130142
Note: See TracChangeset for help on using the changeset viewer.