Changeset 12615


Ignore:
Timestamp:
07/06/15 18:05:35 (4 years ago)
Author:
abeham
Message:

#2416: Added invokerequired check

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Scripting.Views/3.3/VariableStoreView.cs

    r12182 r12615  
    380380
    381381    private void item_ToStringChanged(object sender, EventArgs e) {
    382       foreach (ListViewItem item in variableListView.Items) {
    383         var variable = item.Tag as KeyValuePair<string, object>?;
    384         if (variable == null || variable.Value.Value != sender) continue;
    385 
    386         string value = (variable.Value.Value ?? "null").ToString();
    387         item.SubItems[1].Text = value;
    388         item.SubItems[2].Text = variable.Value.Value.GetType().ToString();
    389         SetToolTipText(item, item.ImageIndex != 0);
     382      if (InvokeRequired) Invoke((Action<object, EventArgs>)item_ToStringChanged, sender, e);
     383      else {
     384        foreach (ListViewItem item in variableListView.Items) {
     385          var variable = item.Tag as KeyValuePair<string, object>?;
     386          if (variable == null || variable.Value.Value != sender) continue;
     387
     388          string value = (variable.Value.Value ?? "null").ToString();
     389          item.SubItems[1].Text = value;
     390          item.SubItems[2].Text = variable.Value.Value.GetType().ToString();
     391          SetToolTipText(item, item.ImageIndex != 0);
     392        }
    390393      }
    391394    }
Note: See TracChangeset for help on using the changeset viewer.