コード例 #1
0
        public static IObservable <IChangeSet <T> > Bind <T>([NotNull] this IObservable <IChangeSet <T> > source,
                                                             [NotNull] ReactiveList <T> targetCollection, int resetThreshold = 25)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (targetCollection == null)
            {
                throw new ArgumentNullException(nameof(targetCollection));
            }

            var adaptor = new ObservableListToReactiveListAdaptor <T>(targetCollection, resetThreshold);

            return(source.Adapt(adaptor));
        }
コード例 #2
0
        public static IObservable <IChangeSet <T> > Bind <T>([NotNull] this IObservable <IChangeSet <T> > source,
                                                             [NotNull] BindingList <T> targetList, int resetThreshold = 25)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (targetList == null)
            {
                throw new ArgumentNullException(nameof(targetList));
            }

            var adaptor = new BindingListAdaptor <T>(targetList, resetThreshold);

            return(source.Adapt(adaptor));
        }
コード例 #3
0
        /// <summary>
        /// Binds the observable changeset to a Cortex.Net observable dictionary.
        /// </summary>
        /// <typeparam name="TValue">The value type of the dictionary.</typeparam>
        /// <typeparam name="TKey">The key type of the dictionary.</typeparam>
        /// <param name="source">The source observable changeset.</param>
        /// <param name="observableDictionary">The observable collection.</param>
        /// <param name="resetThreshold">The threshold to use to just refresh the entire collection.</param>
        /// <returns>The observable changeset.</returns>
        public static IObservable <IChangeSet <TValue, TKey> > CortexBind <TValue, TKey>(this IObservable <IChangeSet <TValue, TKey> > source, ObservableDictionary <TKey, TValue> observableDictionary, int resetThreshold = 25)
        {
            var adapter = new ObservableDictionaryAdapter <TKey, TValue>(observableDictionary, resetThreshold);

            return(source.Adapt(adapter));
        }
コード例 #4
0
        /// <summary>
        /// Binds the observable changeset to a Cortex.Net observable collection.
        /// </summary>
        /// <typeparam name="T">The type of the collection.</typeparam>
        /// <param name="source">The source observable changeset.</param>
        /// <param name="observableCollection">The observable collection.</param>
        /// <param name="equalityComparer">The equality comparer.</param>
        /// <returns>The observable changeset.</returns>
        public static IObservable <IChangeSet <T> > CortexBind <T>(this IObservable <IChangeSet <T> > source, ObservableCollection <T> observableCollection, IEqualityComparer <T> equalityComparer = null)
        {
            var adapter = new ObservableCollectionAdapter <T>(observableCollection, equalityComparer);

            return(source.Adapt(adapter));
        }