Esempio n. 1
0
 public new void Remove(T item)
 {
     if (base.Remove(item))
     {
         ItemsRemoved?.Invoke(this, new ObservableListModified <T>(new List <T> {
             item
         }));
     }
 }
Esempio n. 2
0
        private void Nodes_ItemsRemoved(object sender, ObservableListModified <DarkTreeNode> e)
        {
            if (Nodes.Count == 0)
            {
                Expanded = false;
            }

            ItemsRemoved?.Invoke(this, e);
        }
 protected void OnItemsRemoved()
 {
     if (_disableChangeEvents > 0)
     {
         return;
     }
     UpdateScrollbar();
     ItemsRemoved?.Invoke(this);
 }
Esempio n. 4
0
        /// <summary>
        /// Adds the removed item.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <exception cref="System.ArgumentNullException"></exception>
        public void AddRemovedItem(BaseItem item)
        {
            if (item == null)
            {
                throw new ArgumentNullException();
            }

            ItemsRemoved.Add(item);
        }
Esempio n. 5
0
        public new void Remove(T item)
        {
            base.Remove(item);

            ItemsRemoved?.Invoke(this, new ObservableListModified <T>(new List <T> {
                item
            }));
            ItemsChanged?.Invoke(this, new ObservableListChanged <T>(new List <T> {
                item
            }, NotifyCollectionChangedAction.Remove));
        }
Esempio n. 6
0
        public new void Clear()
        {
            ObservableListModified <T> removed = new(this.ToList <T>());

            base.Clear();

            if (removed.Items.Any())
            {
                ItemsRemoved?.Invoke(this, removed);
            }
        }
        public int MoveWindow(IEnumerable <T> nextItems)
        {
            ItemsRemoved.DequeueAll();
            ItemsInside.EnqueueAll(ItemsInserted.DequeueAll());

            StrongBox <int> amount = new StrongBox <int>(0);

            nextItems.ForEach(newItem =>
            {
                ItemsInserted.Enqueue(newItem);
                ItemsRemoved.Enqueue(ItemsInside.Dequeue());
                amount.Value++;
            });
            return(amount.Value);
        }
Esempio n. 8
0
 private void RaiseItemsRemoved(T[] items)
 {
     OnItemsRemoved(items);
     if (ItemsRemoved != null)
     {
         if (IsLockUpdating)
         {
             EnqueueEvent(ItemsRemoved, new object[] { items });
         }
         else
         {
             ItemsRemoved?.Invoke(items);
         }
     }
     RaiseCollectionChanged();
 }
Esempio n. 9
0
        // --------------------------------------------------------------------------------------------------------------------------
        public void RemoveAt(int index)
        {
            T toRemove = _List[index];

            _List.RemoveAt(index);
            if (CollectionChanged != null)
            {
                // NOTE: The 'Remove' actions will cause access violations in downstream XAML components.
                // A special thanks goes out to MS for allowing this garbage to make it to production!
                var args = new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset);
                CollectionChanged(this, args);

                ItemsRemoved?.Invoke(this, new ItemsChangedEventArgs(toRemove));
                NotifyChange(nameof(Count));
            }
        }
Esempio n. 10
0
        // --------------------------------------------------------------------------------------------------------------------------
        public bool Remove(T item)
        {
            bool res = _List.Remove(item);

            if (res && CollectionChanged != null)
            {
                // NOTE: The 'Remove' actions will cause access violations in downstream XAML components.
                // A special thanks goes out to MS for allowing this garbage to make it to production!
                var args = new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset); //new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, item);
                CollectionChanged(this, args);

                ItemsRemoved?.Invoke(this, new ItemsChangedEventArgs(item));
                NotifyChange(nameof(Count));
            }

            return(res);
        }
Esempio n. 11
0
 protected virtual void OnItemsRemoved(List <T> items)
 {
     ItemsRemoved?.Invoke(this, new PersistedEventArgs <T>(items));
 }
Esempio n. 12
0
 private void Content_Removed(object sender, PropStoreEventArgs e)
 {
     ItemsRemoved?.Invoke(this, e);
 }
Esempio n. 13
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="OldItems"></param>
 protected virtual void OnItemsRemoved(IEnumerable <T> OldItems)
 {
     itemsRemoved?.Invoke(this, new EventArgs <IEnumerable <object> >(OldItems.As <IEnumerable>()?.Cast <object>() ?? Enumerable.Empty <object>()));
     ItemsRemoved?.Invoke(this, new EventArgs <IEnumerable <T> >(OldItems));
 }
 public ReactiveObservableCollection()
 {
     this.ObservableCollection = new ObservableCollection <T>();
     ItemsAdded.Subscribe(ObservableCollection.Add);
     ItemsRemoved.Subscribe((x) => ObservableCollection.Remove(x));
 }
Esempio n. 15
0
 /// <summary>
 /// Событие при удалении элемента из списка.
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnItemsRemoved(EventArgs e)
 {
     ItemsRemoved?.Invoke(this, e);
 }
Esempio n. 16
0
        public void Clear()
        {
            ItemsRemoved?.Invoke(_list);

            _list.Clear();
        }
 protected virtual void OnItemsRemoved(ICollection items) => ItemsRemoved?.Invoke(this, new CollectionItemsChangedEventArgs(items));
        public Vector ChangedCountVector()
        {
            var vec = ItemsInserted.CountVector() - ItemsRemoved.CountVector();

            return(vec);
        }
Esempio n. 19
0
 private void OnItemsRemoved(object sender, DataChangedEventArgs <TEntity> e)
 {
     ItemsRemoved?.Invoke(this, e);
 }
 protected virtual void OnItemsRemoved(EventArgs <IEnumerable <IStudent> > e)
 {
     ItemsRemoved?.Invoke(this, e);
 }