Exemple #1
0
        private static void Add([NotNull] ICollectionChangedEventSource <TEventItem, TCollectionItem> sender, [NotNull] NotifyCollectionChangedEventArgs e)
        {
            var insertPosition = e.NewStartingIndex;

            // ReSharper disable once PossibleNullReferenceException => e.NewItems != null <= NotifyCollectionChangedEventArgs.Constructors. for NotifyCollectionChangedAction.Add
            foreach (TEventItem model in e.NewItems)
            {
                sender.InsertItem(insertPosition++, sender.CreateItem(model));
            }
        }
Exemple #2
0
        private static void Reset([NotNull] ICollectionChangedEventSource <TEventItem, TCollectionItem> sender, NotifyCollectionChangedEventArgs e)
        {
            sender.ClearCollection();
            if (sender.CollectionItemSource == null)
            {
                return;
            }

            foreach (var model in sender.CollectionItemSource)
            {
                sender.AddItem(sender.CreateItem(model));
            }
        }
Exemple #3
0
 private static void Replace([NotNull] ICollectionChangedEventSource <TEventItem, TCollectionItem> sender, [NotNull] NotifyCollectionChangedEventArgs e)
 {
     // ReSharper disable once PossibleNullReferenceException => e.NewItems != null <= NotifyCollectionChangedEventArgs.Constructors. for NotifyCollectionChangedAction.Replace
     sender.ReplaceItem(e.NewStartingIndex, sender.CreateItem((TEventItem)e.NewItems[0]));
 }