Changeset 2707


Ignore:
Timestamp:
01/28/10 20:39:00 (10 years ago)
Author:
mkommend
Message:

changed responsibility for calling OnToolStripItemSet from the MainForm to the ActionUserInterfaceItem (ticket #857)

Location:
trunk/sources/HeuristicLab.MainForm.WindowsForms/3.2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.2/ActionUserInterfaceItem.cs

    r2704 r2707  
    2929  public abstract class ActionUserInterfaceItem : HeuristicLab.MainForm.ActionUserInterfaceItem {
    3030    private ToolStripItem toolStripItem;
    31     public virtual ToolStripItem ToolStripItem {
     31    public ToolStripItem ToolStripItem {
    3232      get { return this.toolStripItem; }
    33       internal set { this.toolStripItem = value; }
     33      internal set {
     34        if (this.toolStripItem != value) {
     35          this.toolStripItem = value;
     36          if (this.toolStripItem == null)
     37            this.OnToolStripItemSet(new EventArgs());
     38        }
     39      }
    3440    }
    3541
     
    3844    }
    3945
    40     protected internal virtual void OnToolStripItemSet(EventArgs e) {
     46    protected virtual void OnToolStripItemSet(EventArgs e) {
    4147    }
    4248  }
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.2/MainForm.cs

    r2704 r2707  
    347347      toolStripItem.Image = userInterfaceItem.Image;
    348348      toolStripItem.Click += new EventHandler(ToolStripItemClicked);
    349       if (userInterfaceItem is ActionUserInterfaceItem)
    350         ((ActionUserInterfaceItem)userInterfaceItem).OnToolStripItemSet(new EventArgs());
    351349      this.userInterfaceItems.Add(userInterfaceItem);
    352350    }
Note: See TracChangeset for help on using the changeset viewer.