Exemplo n.º 1
0
        private void handleSourceCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (!Utils.preHandleSourceCollectionChanged(
                    sender,
                    e,
                    _rootSourceWrapper,
                    ref _lastProcessedSourceChangeMarker,
                    _sourceAsList,
                    ref _isConsistent,
                    ref _handledEventSender,
                    ref _handledEventArgs,
                    ref _deferredProcessings,
                    1, _deferredQueuesCount,
                    this))
            {
                return;
            }

            _thisAsFiltering.processSourceCollectionChanged(sender, e);

            Utils.postHandleChange(
                ref _handledEventSender,
                ref _handledEventArgs,
                _deferredProcessings,
                ref _isConsistent,
                this);
        }
        private void handleSourceCollectionChanged(object sender, NotifyCollectionChangedEventArgs e, ItemInfo itemInfo)
        {
            if (!Utils.preHandleSourceCollectionChanged(
                    sender,
                    e,
                    ref _isConsistent,
                    ref itemInfo.CountPropertyChangedEventRaised,
                    ref itemInfo.IndexerPropertyChangedEventRaised,
                    ref itemInfo.LastProcessedSourceTickTackVersion,
                    itemInfo.SourceAsIHasTickTackVersion,
                    ref _handledEventSender,
                    ref _handledEventArgs,
                    ref _deferredProcessings,
                    1, _deferredQueuesCount, itemInfo))
            {
                return;
            }

            processSourceItemCollectionChanged(e, itemInfo);

            Utils.postHandleChange(
                ref _handledEventSender,
                ref _handledEventArgs,
                _deferredProcessings,
                ref _isConsistent,
                this);
        }
Exemplo n.º 3
0
        private void handleSourceCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (!Utils.preHandleSourceCollectionChanged(
                    sender,
                    e,
                    ref _isConsistent,
                    ref _indexerPropertyChangedEventRaised,
                    ref _lastProcessedSourceChangeMarker,
                    _sourceAsIHasChangeMarker,
                    ref _handledEventSender,
                    ref _handledEventArgs,
                    ref _deferredProcessings,
                    1, _deferredQueuesCount, this))
            {
                return;
            }

            _thisAsSourceCollectionChangeProcessor.processSourceCollectionChanged(sender, e);

            Utils.postHandleChange(
                ref _handledEventSender,
                ref _handledEventArgs,
                _deferredProcessings,
                ref _isConsistent,
                this);
        }
Exemplo n.º 4
0
        private void handleSourceCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (!Utils.preHandleSourceCollectionChanged(
                    ref _indexerPropertyChangedEventRaised,
                    ref _lastProcessedSourceChangeMarker,
                    _sourceAsIHasChangeMarker))
            {
                return;
            }

            switch (e.Action)
            {
            case NotifyCollectionChangedAction.Add:

                //if (e.NewItems.Count > 1) throw new ObservableComputationsException("Adding of multiple items is not supported");
                void add()
                {
                    baseInsertItem(e.NewStartingIndex, (TSourceItem)e.NewItems[0]);
                }

                _destinationOcDispatcher.Invoke(
                    add,
                    _destinationOcDispatcherPriority,
                    _destinationOcDispatcherParameter,
                    this);

                break;

            case NotifyCollectionChangedAction.Remove:
                // (e.OldItems.Count > 1) throw new ObservableComputationsException("Removing of multiple items is not supported");


                void remove()
                {
                    baseRemoveItem(e.OldStartingIndex);
                }

                _destinationOcDispatcher.Invoke(
                    remove,
                    _destinationOcDispatcherPriority,
                    _destinationOcDispatcherParameter,
                    this);

                break;

            case NotifyCollectionChangedAction.Replace:

                //if (e.NewItems.Count > 1) throw new ObservableComputationsException("Replacing of multiple items is not supported");
                void replace()
                {
                    baseSetItem(e.NewStartingIndex, (TSourceItem)e.NewItems[0]);
                }

                _destinationOcDispatcher.Invoke(
                    replace,
                    _destinationOcDispatcherPriority,
                    _destinationOcDispatcherParameter,
                    this);
                break;

            case NotifyCollectionChangedAction.Move:
                int oldStartingIndex1 = e.OldStartingIndex;
                int newStartingIndex1 = e.NewStartingIndex;
                if (oldStartingIndex1 == newStartingIndex1)
                {
                    return;
                }

                void move()
                {
                    baseMoveItem(oldStartingIndex1, newStartingIndex1);
                }

                _destinationOcDispatcher.Invoke(
                    move,
                    _destinationOcDispatcherPriority,
                    _destinationOcDispatcherParameter,
                    this);

                break;

            case NotifyCollectionChangedAction.Reset:
                invokeProcessSource(sender, e);
                break;
            }

            Utils.postHandleChange(
                out _handledEventSender,
                out _handledEventArgs);
        }