Exemplo n.º 1
0
 private void NotifyCollectionReset()
 {
     if (CollectionChanged != null)
     {
         CollectionChanged.Invoke(this,
                                  new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
     }
 }
Exemplo n.º 2
0
 private void NotifyItemAdded(int index, T item)
 {
     if (CollectionChanged != null)
     {
         CollectionChanged.Invoke(this,
                                  new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, item, index));
     }
 }
Exemplo n.º 3
0
 private void OnListChanged(NotifyCollectionChangedAction action)
 {
     if (CollectionChanged != null)
     {
         //TODO Allow different types
         CollectionChanged.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
     }
 }
Exemplo n.º 4
0
 private void NotifyItemRemoved(int index)
 {
     if (CollectionChanged != null)
     {
         CollectionChanged.Invoke(this,
                                  new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, index));
     }
 }
Exemplo n.º 5
0
 public void RemoveAll()
 {
     Clear();
     if (CollectionChanged != null)
     {
         CollectionChanged.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
     }
 }
Exemplo n.º 6
0
 private void OnCollectionChanged(NotifyCollectionChangedEventArgs args)
 {
     if (CollectionChanged != null)
     {
         var N = CollectionChanged.GetInvocationList().Length;
         System.Diagnostics.Debug.WriteLine($"Number of items in event invocation list= {N}");
         CollectionChanged.Invoke(this, args);
     }
 }
Exemplo n.º 7
0
        private void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
        {
            if (IsNotifying && CollectionChanged != null)
            {
                CollectionChanged.Invoke(this, e);
            }

            OnPropertyChanged();
        }
        public void Clear()
        {
            if (CollectionChanged != null)
            {
                CollectionChanged.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, m_Internal));
            }

            m_Internal.Clear();
        }
Exemplo n.º 9
0
        public void AddRange(TreeColumnCollection list)
        {
            this.InnerList.AddRange(list);

            if (CollectionChanged != null)
            {
                CollectionChanged.Invoke(this, new CollectionChangeEventArgs(CollectionChangeAction.Add, list));
            }
        }
Exemplo n.º 10
0
 public void RemoveRange <TEntity>(List <TEntity> obj) where TEntity : class
 {
     Set <TEntity>().RemoveRange(obj);
     SaveChanges();
     if (CollectionChanged is not null)
     {
         CollectionChanged.Invoke(this, new EventArgs());
     }
 }
Exemplo n.º 11
0
        public void Remove(TreeColumn treeColumn)
        {
            this.List.Remove(treeColumn);

            if (CollectionChanged != null)
            {
                CollectionChanged.Invoke(this, new CollectionChangeEventArgs(CollectionChangeAction.Remove, treeColumn));
            }
        }
Exemplo n.º 12
0
        private void NotifyCollectionChanged(FRAFile file, FRAFileChange change)
        {
            FRAFileEventArgs eventArgs = new FRAFileEventArgs(file, change);

            if (CollectionChanged != null)
            {
                CollectionChanged.Invoke(this, eventArgs);
            }
        }
Exemplo n.º 13
0
        protected void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
        {
            if (IsNotifying && CollectionChanged != null)
            {
                CollectionChanged.Invoke(this, e);
            }

            // notify count changed
            OnPropertyChanged(CountString);
        }
Exemplo n.º 14
0
        public async Task UpdateRangeAsync <TEntity>(List <TEntity> obj) where TEntity : class
        {
            Set <TEntity>().UpdateRange(obj);
            await SaveChangesAsync();

            if (CollectionChanged is not null)
            {
                CollectionChanged.Invoke(this, new EventArgs());
            }
        }
Exemplo n.º 15
0
        protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
        {
            base.OnCollectionChanged(e);
            var eh = CollectionChanged;

            if (eh != null)
            {
                using (BlockReentrancy()) CollectionChanged.Invoke(this, e);
            }
        }
Exemplo n.º 16
0
        protected internal void RemoveFile(IDownloadFile file)
        {
            lock (_queue) {
                _queue.Remove(file);
            }

            if (CollectionChanged != null)
            {
                CollectionChanged.Invoke(Queue, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, file));
            }
        }
Exemplo n.º 17
0
 protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
 {
     if (!_SuppressCollectionChanged)
     {
         base.OnCollectionChanged(e);
         if (CollectionChanged != null)
         {
             CollectionChanged.Invoke(this, e);
         }
     }
 }
 public void Insert(int index, T item)
 {
     ThrowIfInHandler();
     try {
         InHandler = true;
         Items.Insert(index, item);
         CollectionChanged.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, item, index));
     } finally {
         InHandler = false;
     }
 }
 public void Add(T item)
 {
     ThrowIfInHandler();
     try {
         InHandler = true;
         Items.Add(item);
         CollectionChanged.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, item, Count - 1));
     } finally {
         InHandler = false;
     }
 }
Exemplo n.º 20
0
        public void Reset()
        {
#if !SILVERLIGHT
            if (changeNotificationsSuppressed == 0 && CollectionChanged != null)
            {
                CollectionChanged.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
            }
#else
            // XXX: SL4 and WP7 hate on this
#endif
        }
Exemplo n.º 21
0
        // Movie that user would like to have removed from their preferences.
        public bool RemoveIfPresent(Movie movie)
        {
            var eventArgs = new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, movie);

            if (movies.Remove(movie))
            {
                CollectionChanged.Invoke(this, eventArgs);
                return(true);
            }
            return(false);
        }
Exemplo n.º 22
0
        public override EntityEntry <TEntity> Remove <TEntity>(TEntity obj) where TEntity : class
        {
            var value = Set <TEntity>().Remove(obj);

            SaveChanges();
            if (CollectionChanged is not null)
            {
                CollectionChanged.Invoke(this, new EventArgs());
            }
            return(value);
        }
Exemplo n.º 23
0
 public void Insert(int index, int item)
 {
     m_Internal.Insert(index, item);
     if (CollectionChanged != null)
     {
         CollectionChanged.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, new List <int>()
         {
             item
         }));
     }
 }
Exemplo n.º 24
0
        public override EntityEntry <TEntity> Update <TEntity>(TEntity obj) where TEntity : class
        {
            var result = Set <TEntity>().Update(obj);

            SaveChanges();
            if (CollectionChanged is not null)
            {
                CollectionChanged.Invoke(this, new EventArgs());
            }
            return(result);
        }
Exemplo n.º 25
0
 protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
 {
     if (suppressNotification)
     {
         return;
     }
     base.OnCollectionChanged(e);
     if (CollectionChanged != null)
     {
         CollectionChanged.Invoke(this, e);
     }
 }
Exemplo n.º 26
0
        public async Task <EntityEntry <TEntity> > RemoveAsync <TEntity>(TEntity obj) where TEntity : class
        {
            var value = Set <TEntity>().Remove(obj);

            await SaveChangesAsync();

            if (CollectionChanged is not null)
            {
                CollectionChanged.Invoke(this, new EventArgs());
            }
            return(value);
        }
Exemplo n.º 27
0
        public void AddValue(Int32 id, Object value)
        {
            AdapterItem ai = new AdapterItem();

            ai.id   = id;
            ai.data = value;
            values.Add(ai);
            if (CollectionChanged != null)
            {
                CollectionChanged.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, value, id));
            }
        }
Exemplo n.º 28
0
        public async Task <EntityEntry <TEntity> > UpdateAsync <TEntity>(TEntity obj) where TEntity : class
        {
            var result = Set <TEntity>().Update(obj);

            await SaveChangesAsync();

            if (CollectionChanged is not null)
            {
                CollectionChanged.Invoke(this, new EventArgs());
            }
            return(result);
        }
        public void RemoveAt(int index)
        {
            ThrowIfInHandler();
            try {
                InHandler = true;

                var oldItem = this [index];
                Items.Remove(oldItem);
                CollectionChanged.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, oldItem, index));
            } finally {
                InHandler = false;
            }
        }
        public void Clear()
        {
            ThrowIfInHandler();
            try {
                InHandler = true;

                //Mono.NativeMethods.collection_clear (native);
                Items.Clear();
                CollectionChanged.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
            } finally {
                InHandler = false;
            }
        }