Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3464


Ignore:
Timestamp:
04/21/10 15:22:39 (15 years ago)
Author:
gkronber
Message:

Added invoke-required check in ViewContextMenuStrip #972.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/ViewContextMenuStrip.cs

    r3437 r3464  
    4343
    4444    private void RefreshMenuItems() {
    45       this.Items.Clear();
    46       this.menuItems.Clear();
     45      if (InvokeRequired) Invoke((Action)RefreshMenuItems);
     46      else {
     47        this.Items.Clear();
     48        this.menuItems.Clear();
    4749
    48       if (this.item != null) {
    49         ToolStripMenuItem menuItem;
    50         IEnumerable<Type> types = MainFormManager.GetViewTypes(item.GetType(),true);
    51         foreach (Type t in types.Except(IgnoredViewTypes)) {
    52           menuItem = new ToolStripMenuItem();
    53           menuItem.Tag = t;
    54           menuItem.Text = ViewAttribute.GetViewName(t);
     50        if (this.item != null) {
     51          ToolStripMenuItem menuItem;
     52          IEnumerable<Type> types = MainFormManager.GetViewTypes(item.GetType(), true);
     53          foreach (Type t in types.Except(IgnoredViewTypes)) {
     54            menuItem = new ToolStripMenuItem();
     55            menuItem.Tag = t;
     56            menuItem.Text = ViewAttribute.GetViewName(t);
    5557
    56           this.menuItems.Add(t, menuItem);
    57           this.Items.Add(menuItem);
     58            this.menuItems.Add(t, menuItem);
     59            this.Items.Add(menuItem);
     60          }
    5861        }
    5962      }
Note: See TracChangeset for help on using the changeset viewer.