Esempio n. 1
0
        public void AddRange(IEnumerable <T> items)
        {
            List <T> added = new List <T>();

            foreach (T item in items)
            {
                if (Add(item, false))
                {
                    added.Add(item);
                }
            }
            if (added.Count > 0)
            {
                SelectionCollectionAddEventArgs <T> args =
                    new SelectionCollectionAddEventArgs <T>(added);
                CollectionChangeAdded?.Invoke(this, args);
            }
        }
Esempio n. 2
0
 private bool Add(T item, bool sendEvent)
 {
     if (!allItems.Any(x => x.Id.Equals(item.Id)))
     {
         allItems.Add(item);
         if (sendEvent)
         {
             SelectionCollectionAddEventArgs <T> args =
                 new SelectionCollectionAddEventArgs <T>(new List <T>()
             {
                 item
             });
             CollectionChangeAdded?.Invoke(this, args);
         }
         return(true);
     }
     return(false);
 }