private DataSourceChangedEventArgs(DataSourceChangeTypeEnum changeType, bool dataWasChanged, string propertyName, CollectionChangeAction action, object element) { ChangeType = changeType; DataWasUpdated = dataWasChanged; PropertyName = propertyName; Action = action; Element = element; }
private void OnDataSourceChanged(DataSourceChangeTypeEnum changeType, bool changed) { Interlocked.CompareExchange(ref DataSourceChanged, null, null)?.Invoke(this, new DataSourceChangedEventArgs(changeType, changed)); }
public DataSourceChangedEventArgs(DataSourceChangeTypeEnum changeType, bool dataWasChanged) : this(changeType, dataWasChanged, null, CollectionChangeAction.Refresh, null) { }
private bool DataSourceHasChanged_Handler(ObservableSource <T> signalingNode, DataSourceChangeTypeEnum changeType, out PropNode sourcePropNode) { sourcePropNode = null; bool isComplete = false; BagNode next; switch (signalingNode.SourceKind) { case SourceKindEnum.AbsRoot: { System.Diagnostics.Debug.Assert(changeType == DataSourceChangeTypeEnum.ParentHasChanged, $"Received a DataSourceChanged event from on a node of kind = AbsRoot. " + $"The DataSourceChangeType should be {nameof(DataSourceChangeTypeEnum.ParentHasChanged)}, but is {changeType}."); System.Diagnostics.Debug.Assert(ReferenceEquals(signalingNode, _rootListener), "Received a ParentHasChanged on a node of kind = AbsRoot and the signaling node is not the _rootListener."); System.Diagnostics.Debug.Assert(_isPathAbsolute, "Received a ParentHasChanged on a node of kind = AbsRoot, but our 'PathIsAbsolute' property is set to false."); // We have a new root, start at the beginning. next = _ourNode.Root; if (next == null) { System.Diagnostics.Debug.WriteLine("OurNode's root is null when processing update to AbsRoot."); return(isComplete); } int nPtr = 0; isComplete = HandleNodeUpdate(next, _pathElements, _pathListeners, nPtr, out sourcePropNode); break; } case SourceKindEnum.Up: { System.Diagnostics.Debug.Assert(changeType == DataSourceChangeTypeEnum.ParentHasChanged, $"DataSourceHasChanged is processing a observable source of kind = {signalingNode.SourceKind}, but the ChangeType does not equal {nameof(DataSourceChangeTypeEnum.ParentHasChanged)}."); if (GetChangedNode(_ourNode, signalingNode, _isPathAbsolute, _pathElements, out next, out int nPtr)) { System.Diagnostics.Debug.Assert(nPtr < _pathElements.Length - 1, "GetChangedNode for 'up' PropertyChanged event returned with nPtr beyond next to last node."); isComplete = HandleNodeUpdate(next, _pathElements, _pathListeners, nPtr, out sourcePropNode); } break; } case SourceKindEnum.Down: { System.Diagnostics.Debug.Assert(changeType == DataSourceChangeTypeEnum.PropertyChanged, $"DataSourceHasChanged is processing a observable source of kind = {signalingNode.SourceKind}, but the ChangeType does not equal {nameof(DataSourceChangeTypeEnum.PropertyChanged)}."); if (GetChangedNode(_ourNode, signalingNode, _isPathAbsolute, _pathElements, out next, out int nPtr)) { System.Diagnostics.Debug.Assert(nPtr < _pathElements.Length - 1, "GetChangedNode for 'down' PropertyChanged event returned with nPtr beyond next to last node."); isComplete = HandleNodeUpdate(next, _pathElements, _pathListeners, nPtr, out sourcePropNode); } break; } case SourceKindEnum.TerminalNode: { System.Diagnostics.Debug.Assert(Complete, "The Complete flag should be set when responding to Terminal node updates."); System.Diagnostics.Debug.WriteLine("Beginning to proccess property changed event raised from the Terminal node of the source path."); if (GetChangedNode(_ourNode, signalingNode, _isPathAbsolute, _pathElements, out next, out int nPtr)) { isComplete = HandleTerminalNodeUpdate(next, _pathElements, nPtr, out sourcePropNode); } break; } default: { throw new InvalidOperationException($"The SourceKind: {signalingNode.SourceKind} is not recognized or is not supported."); } } return(isComplete); }