void OnValueUpdated(object o, EventArgs a) { Application.Invoke(delegate { if (disposed) { return; } ObjectValue val = (ObjectValue)o; TreeIter it; if (FindValue(val, out it)) { // Keep the expression name entered by the user if (store.IterDepth(it) == 0) { val.Name = (string)store.GetValue(it, NameCol); } RemoveChildren(it); TreeIter parent; if (!store.IterParent(out parent, it)) { parent = TreeIter.Zero; } // If it was an evaluating group, replace the node with the new nodes if (val.IsEvaluatingGroup) { if (val.ArrayCount == 0) { store.Remove(ref it); } else { SetValues(parent, it, null, val.GetArrayItem(0)); RegisterValue(val, it); for (int n = 1; n < val.ArrayCount; n++) { TreeIter cit = store.InsertNodeAfter(it); ObjectValue cval = val.GetArrayItem(n); SetValues(parent, cit, null, cval); RegisterValue(cval, cit); } } } else { SetValues(parent, it, val.Name, val); } } UnregisterValue(val); }); }