///-------------------------------------------------------------------------------- /// <summary>This method refreshes the view model.</summary> /// /// <param name="refreshChildren">Flag indicating whether children should be refreshed.</param> ///-------------------------------------------------------------------------------- public void Refresh(bool refreshChildren, int refreshLevel = 0) { if (refreshChildren == true || refreshLevel > 0) { } #region protected #endregion protected HasErrors = !StateTransition.IsValid; HasCustomizations = StateTransition.IsAutoUpdated == false || StateTransition.IsEmptyMetadata(StateTransition.ForwardInstance) == false || ChildrenHaveAnyCustomizations(); if (HasCustomizations == false && StateTransition.ReverseInstance != null) { // remove customizations if solely due to child customizations no longer present StateTransition.IsAutoUpdated = true; StateTransition.SpecSourceName = StateTransition.ReverseInstance.SpecSourceName; StateTransition.ResetModified(StateTransition.ReverseInstance.IsModified); StateTransition.ResetLoaded(StateTransition.ReverseInstance.IsLoaded); if (!StateTransition.IsIdenticalMetadata(StateTransition.ReverseInstance)) { HasCustomizations = true; StateTransition.IsAutoUpdated = false; } } if (HasCustomizations == false) { // clear customizations StateTransition.ForwardInstance = null; StateTransition.ReverseInstance = null; StateTransition.IsAutoUpdated = true; } OnPropertyChanged("Items"); OnPropertyChanged("HasCustomizations"); OnPropertyChanged("HasErrors"); }