internal virtual void RefreshInternal() { // Check if need to update value if (_hasValueDirty) { // Cleanup (won't retry update in case of exception) object val = _valueToSet; _hasValueDirty = false; _valueToSet = null; // Assign value _values.Set(_parent.Values, val); // Propagate values up (eg. when member of structure gets modified, also structure should be updated as a part of the other object) var obj = _parent; while (obj._parent != null) { obj._parent.SyncChildValues(obj.Values); obj = obj._parent; } } else { // Update values _values.Refresh(_parent.Values); } // Update itself _isSetBlocked = true; Refresh(); _isSetBlocked = false; // Update children for (int i = 0; i < _children.Count; i++) { _children[i].RefreshInternal(); } }
internal virtual void RefreshInternal() { if (_values == null) { return; } // Check if need to update value if (_hasValueDirty) { // Cleanup (won't retry update in case of exception) object val = _valueToSet; _hasValueDirty = false; _valueToSet = null; // Assign value _values.Set(_parent.Values, val); // Propagate values up (eg. when member of structure gets modified, also structure should be updated as a part of the other object) var obj = _parent; while (obj._parent != null && !(obj._parent is SyncPointEditor)) // && obj.NeedsValuePropagationUp) { obj.Values.Set(obj._parent.Values, obj.Values); obj = obj._parent; } OnUnDirty(); } else { // Update values _values.Refresh(_parent.Values); } // Update itself _isSetBlocked = true; Refresh(); _isSetBlocked = false; // Update children try { var childrenCount = _skipChildrenRefresh ? 0 : _children.Count; for (int i = 0; i < childrenCount; i++) { _children[i].RefreshInternal(); } _skipChildrenRefresh = false; } catch (TargetException ex) { // This happens when one of the edited objects changes its type. // Eg. from Label to TextBox, while both types were assigned to the same field of type Control. // It's valid, just rebuild the child editors and log the warning to keep it tracking. Editor.LogWarning("Exception while updating the child editors"); Editor.LogWarning(ex); RebuildLayoutOnRefresh(); } // Rebuild if flag is set if (_rebuildOnRefresh) { _rebuildOnRefresh = false; RebuildLayout(); } }
/// <summary> /// Synchronizes the value of the <see cref="Values"/> container. Called during Refresh to flush property after editing it in UI. /// </summary> /// <param name="value">The value to set.</param> protected virtual void SynchronizeValue(object value) { _values.Set(_parent.Values, value); }
/// <summary> /// Synchronizes the child values container with this editor values. /// </summary> /// <param name="values">The values to synchronize.</param> protected virtual void SyncChildValues(ValueContainer values) { values.Set(Values); }