//// Reset //public NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction action); //// Add, Remove, Reset //public NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction action, IList changedItems); //public NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction action, object changedItem); //public NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction action, object changedItem, int index); //public NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction action, IList changedItems, int startingIndex); //// Replace //public NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction action, IList newItems, IList oldItems); //public NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction action, object newItem, object oldItem); //public NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction action, IList newItems, IList oldItems, int startingIndex); //public NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction action, object newItem, object oldItem, int index); //// Move //public NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction action, IList changedItems, int index, int oldIndex); //public NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction action, object changedItem, int index, int oldIndex); public CollectionSynchronizer(IList <TSource> source, IList <TDestination> destination, ObjectSynchronizer <TSource, TDestination, TBinder> synchronizer) { Requires.NotNull(source); Requires.NotNull(destination); Requires.NotNull(synchronizer); // допускаем синхронизацию в любую сторону //Requires.Argument(source is INotifyCollectionChanged); //Requires.Argument(destination is INotifyCollectionChanged); // ниже вызывается Reset //Requires.Empty(destination); _source = source; _destination = destination; _synchronizer = synchronizer; TryAdd(_source, OnSourceCollectionChanged); TryAdd(_destination, OnDestinationCollectionChanged); if (_source.Count > 0 || _destination.Count > 0) { // начальная синхронизация OnSourceCollectionChanged(_source, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); } }
public static CollectionSynchronizer <TSource, TDestination> Collections <TSource, TDestination>( IList <TSource> source, IList <TDestination> destination, ObjectSynchronizer <TSource, TDestination> synchronizer) where TSource : class where TDestination : class { Requires.NotNull(source); Requires.NotNull(destination); Requires.NotNull(synchronizer); return(new CollectionSynchronizer <TSource, TDestination>(source, destination, synchronizer)); }
public CollectionSynchronizer(IList <TSource> source, IList <TDestination> destination, ObjectSynchronizer <TSource, TDestination> synchronizer) : base(source, destination, synchronizer) { Requires.NotNull(destination); }