コード例 #1
0
 void ISourceIndexerPropertyTracker.HandleSourcePropertyChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs)
 {
     Utils.HandleSourcePropertyChanged(propertyChangedEventArgs, ref _indexerPropertyChangedEventRaised);
 }
コード例 #2
0
 protected override void uninitialize()
 {
     Utils.uninitializeSourceScalar(_sourcesScalar, scalarValueChangedHandler, ref _sources);
 }
コード例 #3
0
 private Concatenating(int capacity) : base(capacity)
 {
     Utils.initializeItemInfos(capacity,out _itemInfos, out _sourceRangePositions);
     _thisAsSourceCollectionChangeProcessor = this;
 }
コード例 #4
0
		public Ordering(
			IReadScalar<INotifyCollectionChanged> sourceScalar,
			Expression<Func<TSourceItem, TOrderingValue>> orderingValueSelectorExpression,
			IReadScalar<ListSortDirection> sortDirectionScalar = null,
			IComparer<TOrderingValue> comparer = null) : this(orderingValueSelectorExpression, Utils.getCapacity(sourceScalar))
		{
			_sourceScalar = sourceScalar;
			_sortDirectionScalar = sortDirectionScalar;
			_comparer = comparer ?? Comparer<TOrderingValue>.Default;
		}
コード例 #5
0
        protected override void initializeFromSource()
		{
			int originalCount = _items.Count;

			if (_sourceInitialized)
			{
				int itemInfosCount = _itemInfos.Count;
				for (int index = 0; index < itemInfosCount; index++)
				{
					ItemInfo itemInfo = _itemInfos[index];
					if (itemInfo.Source != null)
                    {
                        itemInfo.Source.CollectionChanged -=
                            itemInfo.SourceNotifyCollectionChangedEventHandler;

                        if (itemInfo.SourceAsINotifyPropertyChanged != null)
                            itemInfo.SourceAsINotifyPropertyChanged.PropertyChanged -=
                                itemInfo.SourcePropertyChangedEventHandler;
                    }

                    if (itemInfo.SourceScalar != null)
                        itemInfo.SourceScalar.PropertyChanged -= itemInfo.SourceScalarPropertyChangedEventHandler;                   
				}

                Utils.initializeItemInfos(
                    Utils.getCapacity(_sourcesScalar, _sources),
                    out _itemInfos,
                    out _sourceRangePositions);

				_sources.CollectionChanged -= handleSourcesCollectionChanged;

                if (_sourcesAsINotifyPropertyChanged != null)
                {
                    _sourcesAsINotifyPropertyChanged.PropertyChanged -=
                        ((ISourceIndexerPropertyTracker) this).HandleSourcePropertyChanged;
                    _sourcesAsINotifyPropertyChanged = null;
                }

                _sourceInitialized = false;
            }

            Utils.changeSource(ref _sources, _sourcesScalar, _downstreamConsumedComputings, _consumers, this,
                ref _sourcesAsList, true);

			if (_sources != null && _isActive)
			{
                Utils.initializeFromHasChangeMarker(
                    out _sourcesAsIHasChangeMarker, 
                    _sourcesAsList, 
                    ref _lastProcessedSourcesChangeMarker, 
                    ref _sourcesAsINotifyPropertyChanged,
                    (ISourceIndexerPropertyTracker)this);


				int plainIndex = 0;
				int count = _sourcesAsList.Count;
                object[] sourcesCopy = new object[count];
                _sourcesAsList.CopyTo(sourcesCopy, 0);
				for (int index = 0; index < count; index++)
				{
					object sourceItemObject = sourcesCopy[index];
					IReadScalar<object> sourceItemScalar = sourceItemObject as IReadScalar<object>;
					IList sourceItem = sourceItemScalar != null ? (IList)sourceItemScalar.Value : (IList) sourceItemObject;
					int sourceItemCount = sourceItem?.Count ?? 0;
					ItemInfo itemInfo = _sourceRangePositions.Add(sourceItemCount);
					registerSourceItem(sourceItemObject, itemInfo);
                    IList<TSourceItem> sourceCopy = itemInfo.SourceCopy;

					for (int sourceSourceIndex = 0; sourceSourceIndex < sourceItemCount; sourceSourceIndex++)
                    {

                        if (originalCount > plainIndex)
							// ReSharper disable once PossibleNullReferenceException
							_items[plainIndex++] = sourceCopy[sourceSourceIndex];
						else
							// ReSharper disable once PossibleNullReferenceException
							_items.Insert(plainIndex++, sourceCopy[sourceSourceIndex]);
                    }	
				}

				for (int index = originalCount - 1; index >= plainIndex; index--)
				{
					_items.RemoveAt(index);
				}

				_sources.CollectionChanged += handleSourcesCollectionChanged;
                _sourceInitialized = true;
            }
			else
			{
				_items.Clear();
			}

			reset();
		}
コード例 #6
0
		public Ordering(
			IReadScalar<INotifyCollectionChanged> sourceScalar,
			Expression<Func<TSourceItem, TOrderingValue>> orderingValueSelectorExpression,
			ListSortDirection sortDirection = ListSortDirection.Ascending,
			IReadScalar<IComparer<TOrderingValue>> comparerScalar = null) : this(orderingValueSelectorExpression, Utils.getCapacity(sourceScalar))
		{
			_sourceScalar = sourceScalar;
			_sortDirection = sortDirection;
			_comparerScalar = comparerScalar;
		}
コード例 #7
0
		public CollectionProcessingVoid(
			INotifyCollectionChanged source,
			Action<TSourceItem[], CollectionProcessingVoid<TSourceItem>> newItemsProcessor = null,
			Action<TSourceItem[], CollectionProcessingVoid<TSourceItem>> oldItemsProcessor = null,
			Action<TSourceItem, CollectionProcessingVoid<TSourceItem>> moveItemProcessor = null) : this(newItemsProcessor, oldItemsProcessor, moveItemProcessor, Utils.getCapacity(source))
		{
			_source = source;
			_thisAsSourceCollectionChangeProcessor = this;
		}
コード例 #8
0
		protected override void initialize()
		{
			Utils.initializeSourceScalar(_sourceScalar, ref _source, scalarValueChangedHandler);
		}
コード例 #9
0
		internal override void removeFromUpstreamComputings(IComputingInternal computing)		
		{
			Utils.RemoveDownstreamConsumedComputing(computing, _sourceScalar, _source);
		}
コード例 #10
0
		internal override void addToUpstreamComputings(IComputingInternal computing)
		{
			Utils.AddDownstreamConsumedComputing(computing, _sourceScalar, _source);
		}