Exemplo n.º 1
0
        protected override void OnReplace(BulkUpdateableCollection <T> collection, IReadOnlyList <T> items)
        {
            collection.Items.Clear();

            foreach (var e in items)
            {
                collection.Items.Add(e);
            }

            collection.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
        }
Exemplo n.º 2
0
 public override int RemoveAll(BulkUpdateableCollection <T> collection, Func <T, bool> predicate)
 {
     lock (((ICollection)collection).SyncRoot)
     {
         var c = 0;
         for (var i = collection.Count - 1; i >= 0; i--)
         {
             if (predicate(collection[i]))
             {
                 collection.Items.RemoveAt(i);
                 c++;
             }
         }
         if (c > 0)
         {
             collection.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
         }
         return(c);
     }
 }
Exemplo n.º 3
0
 protected override void OnClear(BulkUpdateableCollection <T> collection)
 {
     collection.Clear();
     collection.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
 }