/// <summary> /// Returns state of changes and reset internal change switches if <c>acceptChange</c> is TRUE /// </summary> /// <param name="acceptChanges">if set to <c>true</c> [accept changes].</param> /// <returns>Changes report</returns> public ObjectScopeChangeReport getState(Boolean acceptChanges = true) { ObjectScopeChangeReport output = State; if (acceptChanges) { State = new ObjectScopeChangeReport(); return(output); } else { return(State); } }
/// <summary> /// Checks for changes and records it into internal change switches /// </summary> /// <param name="target">Monitored object</param> public void update(IObjectWithPathAndChildSelector target) { if (State == null) { State = new ObjectScopeChangeReport(); } if (lastTarget != target) { State.IsTargetChanged = true; lastTarget = target; } if (target == null) { return; } if (lastPath != target.path) { State.IsPathChanged = true; lastPath = target.path; } if (lastParent != target.parent) { State.IsParentChanged = true; lastParent = target.parent; } if (lastRoot != target.root) { State.IsRootChanged = true; lastRoot = target.root; } if (lastChildrenCount != target.Count()) { State.IsChildrenCountChanged = true; lastChildrenCount = target.Count(); } }