Пример #1
0
        protected internal void clearItems()
        {
            void perform()
            {
                PreCollectionChanged?.Invoke(this, null);
                base.ClearItems();
                PostCollectionChanged?.Invoke(this, null);
            }

            ChangeMarkerField = !ChangeMarkerField;

            _currentChange = NotifyCollectionChangedAction.Reset;

            if (Configuration.TrackComputingsExecutingUserCode)
            {
                int currentThreadId = Utils.startComputingExecutingUserCode(out IComputing computing, out _userCodeIsCalledFrom, this);

                perform();

                Utils.endComputingExecutingUserCode(computing, currentThreadId, out _userCodeIsCalledFrom);
            }
            else
            {
                perform();
            }

            _currentChange = null;
        }
Пример #2
0
        protected internal void insertItem(int index, TItem item)
        {
            void perform()
            {
                PreCollectionChanged?.Invoke(this, null);
                base.InsertItem(index, item);
                PostCollectionChanged?.Invoke(this, null);
            }

            ChangeMarkerField = !ChangeMarkerField;

            _currentChange = NotifyCollectionChangedAction.Add;
            _newIndex      = index;
            _newItem       = item;

            if (Configuration.TrackComputingsExecutingUserCode)
            {
                int currentThreadId = Utils.startComputingExecutingUserCode(out IComputing computing, out _userCodeIsCalledFrom, this);

                perform();

                Utils.endComputingExecutingUserCode(computing, currentThreadId, out _userCodeIsCalledFrom);
            }
            else
            {
                perform();
            }

            _currentChange = null;
            _newIndex      = -1;
            _newItem       = default(TItem);
        }
Пример #3
0
        protected internal void setItem(int index, TItem item)
        {
            void perform()
            {
                PreCollectionChanged?.Invoke(this, null);
                base.SetItem(index, item);
                PostCollectionChanged?.Invoke(this, null);
            }

            TickTackVersion = !TickTackVersion;

            _currentChange = NotifyCollectionChangedAction.Replace;
            _newItem       = item;
            _newIndex      = index;
            _oldIndex      = index;

            if (OcConfiguration.TrackComputingsExecutingUserCode)
            {
                int currentThreadId = Utils.startComputingExecutingUserCode(out IComputing computing, out _userCodeIsCalledFrom, this);

                perform();

                Utils.endComputingExecutingUserCode(computing, currentThreadId, out _userCodeIsCalledFrom);
            }
            else
            {
                perform();
            }

            _currentChange = null;
            _newItem       = default;
            _newIndex      = -1;
            _oldIndex      = -1;
        }
Пример #4
0
        protected internal void moveItem(int oldIndex, int newIndex)
        {
            void perform()
            {
                PreCollectionChanged?.Invoke(this, null);
                base.MoveItem(oldIndex, newIndex);
                PostCollectionChanged?.Invoke(this, null);
            }

            ChangeMarkerField = !ChangeMarkerField;

            _currentChange = NotifyCollectionChangedAction.Move;
            _oldIndex      = oldIndex;
            _newIndex      = newIndex;

            if (Configuration.TrackComputingsExecutingUserCode)
            {
                int currentThreadId = Utils.startComputingExecutingUserCode(out IComputing computing, out _userCodeIsCalledFrom, this);

                perform();

                Utils.endComputingExecutingUserCode(computing, currentThreadId, out _userCodeIsCalledFrom);
            }
            else
            {
                perform();
            }

            _currentChange = null;
            _oldIndex      = -1;
            _newIndex      = -1;
        }
Пример #5
0
        private TReturnValue processNewItem(TSourceItem sourceItem)
        {
            if (Configuration.TrackComputingsExecutingUserCode)
            {
                var          currentThread = Utils.startComputingExecutingUserCode(out var computing, out _userCodeIsCalledFrom, this);
                TReturnValue returnValue   = _newItemProcessor(sourceItem, this);
                Utils.endComputingExecutingUserCode(computing, currentThread, out _userCodeIsCalledFrom);
                return(returnValue);
            }

            return(_newItemProcessor(sourceItem, this));
        }
Пример #6
0
        private void processMovedItem(TSourceItem sourceItem)
        {
            if (OcConfiguration.TrackComputingsExecutingUserCode)
            {
                int currentThreadId = Utils.startComputingExecutingUserCode(out IComputing computing, out _userCodeIsCalledFrom, this);
                _moveItemProcessor(sourceItem, this);
                Utils.endComputingExecutingUserCode(computing, currentThreadId, out _userCodeIsCalledFrom);
                return;
            }

            _moveItemProcessor(sourceItem, this);
        }
        private void processOldItem(TSourceItem sourceItem)
        {
            if (Configuration.TrackComputingsExecutingUserCode)
            {
                var currentThread = Utils.startComputingExecutingUserCode(out var computing, out _userCodeIsCalledFrom, this);
                _oldItemProcessor(sourceItem, this);
                Utils.endComputingExecutingUserCode(computing, currentThread, out _userCodeIsCalledFrom);
                return;
            }

            _oldItemProcessor(sourceItem, this);
        }
Пример #8
0
        private TReturnValue[] processNewItems(TSourceItem[] sourceItems)
        {
            if (OcConfiguration.TrackComputingsExecutingUserCode)
            {
                int            currentThreadId = Utils.startComputingExecutingUserCode(out IComputing computing, out _userCodeIsCalledFrom, this);
                TReturnValue[] returnValues    = _newItemsProcessor(sourceItems, this);
                Utils.endComputingExecutingUserCode(computing, currentThreadId, out _userCodeIsCalledFrom);
                return(returnValues);
            }

            return(_newItemsProcessor(sourceItems, this));
        }
Пример #9
0
		private void processNewItems(TSourceItem[] sourceItems)
		{
			if (Configuration.TrackComputingsExecutingUserCode)
			{
				int currentThreadId = Utils.startComputingExecutingUserCode(out IComputing computing, out _userCodeIsCalledFrom, this);
				_newItemsProcessor(sourceItems, this);
				Utils.endComputingExecutingUserCode(computing, currentThreadId, out _userCodeIsCalledFrom);
				return;
			}

			_newItemsProcessor(sourceItems, this);
		}
        private TResult deaggregate(TSourceItem removedSourceItem, TResult value)
        {
            if (OcConfiguration.TrackComputingsExecutingUserCode)
            {
                int     currentThreadId = Utils.startComputingExecutingUserCode(out IComputing computing, out _userCodeIsCalledFrom, this);
                TResult result          = _deaggregateFunc(removedSourceItem, value);
                Utils.endComputingExecutingUserCode(computing, currentThreadId, out _userCodeIsCalledFrom);
                return(result);
            }

            return(_deaggregateFunc(removedSourceItem, value));
        }
Пример #11
0
 private void processNewValue(TValue newValue)
 {
     if (Configuration.TrackComputingsExecutingUserCode)
     {
         var currentThread = Utils.startComputingExecutingUserCode(out var computing, out _userCodeIsCalledFrom, this);
         _newValueProcessor(newValue, this);
         Utils.endComputingExecutingUserCode(computing, currentThread, out _userCodeIsCalledFrom);
     }
     else
     {
         _newValueProcessor(newValue, this);
     }
 }
Пример #12
0
        private TReturnValue processNewValue(TValue newValue)
        {
            if (OcConfiguration.TrackComputingsExecutingUserCode)
            {
                int          currentThreadId = Utils.startComputingExecutingUserCode(out IComputing computing, out _userCodeIsCalledFrom, this);
                TReturnValue returnValue     = _newValueProcessor(newValue, this);
                Utils.endComputingExecutingUserCode(computing, currentThreadId, out _userCodeIsCalledFrom);

                return(returnValue);
            }
            else
            {
                return(_newValueProcessor(newValue, this));
            }
        }
Пример #13
0
        public TOrderingValue GetOrderingValueBySourceIndex(int sourceIndex)
        {
            TOrderingValue getValue() =>
            !_orderingValueSelectorContainsParametrizedLiveLinqCalls
                                ? _orderingValueSelectorFunc(_sourceAsList[sourceIndex])
                                : _itemInfos[sourceIndex].GetOrderingValueFunc();

            if (Configuration.TrackComputingsExecutingUserCode)
            {
                int            currentThreadId = Utils.startComputingExecutingUserCode(out IComputing computing, out _userCodeIsCalledFrom, this);
                TOrderingValue result          = getValue();
                Utils.endComputingExecutingUserCode(computing, currentThreadId, out _userCodeIsCalledFrom);
                return(result);
            }

            return(getValue());
        }
Пример #14
0
        // ReSharper disable once MemberCanBePrivate.Global
        public bool ApplyPredicate(int sourceIndex)
        {
            bool getValue() =>
            _predicateContainsParametrizedObservableComputationCalls
                    ? _itemInfos[sourceIndex].PredicateFunc()
                    : _predicateFunc(_sourceAsList[sourceIndex]);

            if (Configuration.TrackComputingsExecutingUserCode)
            {
                var  currentThread = Utils.startComputingExecutingUserCode(out var computing, out _userCodeIsCalledFrom, this);
                bool result        = getValue();
                Utils.endComputingExecutingUserCode(computing, currentThread, out _userCodeIsCalledFrom);
                return(result);
            }

            return(getValue());
        }
Пример #15
0
		private TOrderingValue getOrderingValue(OrderingItemInfo<TOrderingValue> itemInfo, TSourceItem sourceItem)
		{
            TOrderingValue getValue() => 
                !_orderingValueSelectorContainsParametrizedLiveLinqCalls 
				    ? _orderingValueSelectorFunc(sourceItem) 
				    : itemInfo.GetOrderingValueFunc();

            if (Configuration.TrackComputingsExecutingUserCode)
            {
                var currentThread = Utils.startComputingExecutingUserCode(out var computing, out _userCodeIsCalledFrom, this);
                TOrderingValue result = getValue();
                Utils.endComputingExecutingUserCode(computing, currentThread, out _userCodeIsCalledFrom);
                return result;
            }

            return getValue();
		}
Пример #16
0
        private TResultItem applySelector(ItemInfo itemInfo, TSourceItem sourceItem)
        {
            TResultItem getValue() =>
            _selectorContainsParametrizedObservableComputationsCalls
                                        ? itemInfo.SelectorFunc()
                                        : _selectorFunc(sourceItem);

            if (Configuration.TrackComputingsExecutingUserCode)
            {
                int         currentThreadId = Utils.startComputingExecutingUserCode(out IComputing computing, out _userCodeIsCalledFrom, this);
                TResultItem result          = getValue();
                Utils.endComputingExecutingUserCode(computing, currentThreadId, out _userCodeIsCalledFrom);
                return(result);
            }

            return(getValue());
        }
Пример #17
0
        private TResult getResult()
        {
            TResult result;

            if (OcConfiguration.TrackComputingsExecutingUserCode)
            {
                int currentThreadId = Utils.startComputingExecutingUserCode(out IComputing computing, out _userCodeIsCalledFrom, this);
                result = _getValueFunc();
                Utils.endComputingExecutingUserCode(computing, currentThreadId, out _userCodeIsCalledFrom);
            }
            else
            {
                result = _getValueFunc();
            }

            return(result);
        }
Пример #18
0
        private TResult getValue()
        {
            TResult value;

            if (OcConfiguration.TrackComputingsExecutingUserCode)
            {
                int currentThreadId = Utils.startComputingExecutingUserCode(out IComputing computing, out _userCodeIsCalledFrom, this);
                value = _getter(_source);
                Utils.endComputingExecutingUserCode(computing, currentThreadId, out _userCodeIsCalledFrom);
            }
            else
            {
                value = _getter(_source);
            }

            return(value);
        }
        private TResult getValue()
        {
            TResult value;

            if (Configuration.TrackComputingsExecutingUserCode)
            {
                var currentThread = Utils.startComputingExecutingUserCode(out var computing, out _userCodeIsCalledFrom, this);
                value = _getter(_propertyHolder);
                Utils.endComputingExecutingUserCode(computing, currentThread, out _userCodeIsCalledFrom);
            }
            else
            {
                value = _getter(_propertyHolder);
            }

            return(value);
        }
Пример #20
0
        bool IFiltering <TSourceItem> .applyPredicate(TSourceItem sourceItem, Func <bool> itemPredicateFunc)
        {
            bool getValue() =>
            _predicateContainsParametrizedObservableComputationsCalls
                                        ? itemPredicateFunc()
                                        : _predicateFunc(sourceItem);

            if (Configuration.TrackComputingsExecutingUserCode)
            {
                int  currentThreadId = Utils.startComputingExecutingUserCode(out IComputing computing, out _userCodeIsCalledFrom, this);
                bool result          = getValue();
                Utils.endComputingExecutingUserCode(computing, currentThreadId, out _userCodeIsCalledFrom);
                return(result);
            }

            return(getValue());
        }
Пример #21
0
		public TOrderingValue GetOrderingValueByOrderedIndex(int orderedIndex)
		{
            TOrderingValue getValue() => 
                !_orderingValueSelectorContainsParametrizedLiveLinqCalls 
				    ? _orderingValueSelectorFunc(this[orderedIndex]) 
				    : _orderedItemInfos[orderedIndex].ItemInfo.GetOrderingValueFunc();

            if (Configuration.TrackComputingsExecutingUserCode)
            {
                var currentThread = Utils.startComputingExecutingUserCode(out var computing, out _userCodeIsCalledFrom, this);
                TOrderingValue result = getValue();
                Utils.endComputingExecutingUserCode(computing, currentThread, out _userCodeIsCalledFrom);
                return result;
            }

            return getValue();
		}
Пример #22
0
        private void processOldValue(TValue oldValue)
        {
            if (_oldValueProcessor == null)
            {
                return;
            }

            if (OcConfiguration.TrackComputingsExecutingUserCode)
            {
                int currentThreadId = Utils.startComputingExecutingUserCode(out IComputing computing, out _userCodeIsCalledFrom, this);
                _oldValueProcessor(oldValue, this, _value);
                Utils.endComputingExecutingUserCode(computing, currentThreadId, out _userCodeIsCalledFrom);
            }
            else
            {
                _oldValueProcessor(oldValue, this, _value);
            }
        }