Exemplo n.º 1
0
        protected override void RemoveItem(int index)
        {
            if (IsNotificationsSuspended)
            {
                _IsDirty = true;
            }
            else
            {
                var collectionChangingEventArgs = new CollectionChangingEventArgs <T>(Items[index], index, CollectionChangeAction.Remove);
                CollectionChanging(this, collectionChangingEventArgs);
                if (collectionChangingEventArgs.Cancel)
                {
                    return;
                }
            }

            base.RemoveItem(index);
        }
Exemplo n.º 2
0
        protected override void ClearItems()
        {
            if (IsNotificationsSuspended)
            {
                _IsDirty = true;
            }
            else
            {
                var collectionChangingEventArgs = new CollectionChangingEventArgs <T>(default(T), 0, CollectionChangeAction.Refresh);
                CollectionChanging(this, collectionChangingEventArgs);
                if (collectionChangingEventArgs.Cancel)
                {
                    return;
                }
            }

            base.ClearItems();
        }
Exemplo n.º 3
0
        protected override void InsertItem(int index, T item)
        {
            if (IsNotificationsSuspended)
            {
                _IsDirty = true;
                base.InsertItem(index, item);
            }
            else
            {
                var collectionChangingEventArgs = new CollectionChangingEventArgs <T>(item, index, CollectionChangeAction.Add);
                CollectionChanging(this, collectionChangingEventArgs);

                if (collectionChangingEventArgs.Cancel)
                {
                    return;
                }

                base.InsertItem(index, collectionChangingEventArgs.Item);
            }
        }