コード例 #1
0
        public void RemoveRange(IEnumerable <T> targetItems)
        {
            List <IIdentifier> removed = new List <IIdentifier>();

            foreach (T target in targetItems)
            {
                if (Remove(target, false))
                {
                    removed.Add(target.Identifier);
                }
            }
            if (removed.Count > 0)
            {
                SelectionCollectionRemoveEventArgs args =
                    new SelectionCollectionRemoveEventArgs(removed);
                CollectionChangeRemoved?.Invoke(this, args);
            }
        }
コード例 #2
0
 private bool Remove(T targetItem, bool sendEvent)
 {
     if (allItems.Any(x => x.Target.Identifier.Id.Equals(targetItem.Identifier.Id)))
     {
         allItems.Remove(allItems.First(x => x.Target.Identifier.Id.Equals(targetItem.Identifier.Id)));
         if (sendEvent)
         {
             SelectionCollectionRemoveEventArgs args =
                 new SelectionCollectionRemoveEventArgs(new List <IIdentifier>()
             {
                 targetItem.Identifier
             });
             CollectionChangeRemoved?.Invoke(this, args);
         }
         return(true);
     }
     return(false);
 }
コード例 #3
0
        private void Remove(IEnumerable <IIdentifier> targetIdentifiers)
        {
            List <IIdentifier> removed = new List <IIdentifier>();

            foreach (IIdentifier item in targetIdentifiers)
            {
                if (allItems.Any(x => x.Target.Identifier.Id.Equals(item.Id)))
                {
                    allItems.Remove(allItems.First(x => x.Target.Identifier.Id.Equals(item.Id)));
                    removed.Add(item);
                }
            }

            if (removed.Count > 0)
            {
                SelectionCollectionRemoveEventArgs args =
                    new SelectionCollectionRemoveEventArgs(removed);
                CollectionChangeRemoved?.Invoke(this, args);
            }
        }