public void Refresh() { if (Parent == null) { throw new InvalidOperationException("The node to refresh can be a root node."); } if (CombinedNodes.Any(x => x != null)) { var parent = (CombinedObservableNode)Parent; parent.NotifyPropertyChanging(Name); NotifyNodeUpdating(); if (AreCombinable(CombinedNodes)) { ClearCommands(); foreach (var child in Children.Cast <ObservableNode>().ToList()) { RemoveChild(child); } foreach (var modelNode in CombinedNodes.OfType <ObservableModelNode>()) { modelNode.ForceSetValue(modelNode.Value); } Initialize(); } NotifyNodeUpdated(); parent.NotifyPropertyChanged(Name); } }
// TODO: do not remove from parent if we can avoid it public void Refresh() { if (Parent == null) { throw new InvalidOperationException("The node to refresh can be a root node."); } OnPropertyChanging("TypedValue", "HasMultipleValues", "IsPrimitive", "HasList", "HasDictionary"); if (CombinedNodes.Any(x => x != null)) { var parent = (CombinedObservableNode)Parent; parent.RemoveChild(this); if (AreCombinable(CombinedNodes)) { ClearCommands(); foreach (var child in Children.ToList()) { RemoveChild(child); } foreach (var modelNode in CombinedNodes.OfType <ObservableModelNode>()) { modelNode.Refresh(); } Initialize(true); } parent.AddChild(this); } OnPropertyChanged("TypedValue", "HasMultipleValues", "IsPrimitive", "HasList", "HasDictionary"); }