예제 #1
0
 private void NotifyCollectionReset()
 {
     if (CollectionChanged != null)
     {
         CollectionChanged.Invoke(this,
                                  new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
     }
 }
예제 #2
0
 private void NotifyItemAdded(int index, T item)
 {
     if (CollectionChanged != null)
     {
         CollectionChanged.Invoke(this,
                                  new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, item, index));
     }
 }
예제 #3
0
 private void OnListChanged(NotifyCollectionChangedAction action)
 {
     if (CollectionChanged != null)
     {
         //TODO Allow different types
         CollectionChanged.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
     }
 }
예제 #4
0
 private void NotifyItemRemoved(int index)
 {
     if (CollectionChanged != null)
     {
         CollectionChanged.Invoke(this,
                                  new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, index));
     }
 }
예제 #5
0
 public void RemoveAll()
 {
     Clear();
     if (CollectionChanged != null)
     {
         CollectionChanged.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
     }
 }
예제 #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);
     }
 }
예제 #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();
        }
예제 #9
0
        public void AddRange(TreeColumnCollection list)
        {
            this.InnerList.AddRange(list);

            if (CollectionChanged != null)
            {
                CollectionChanged.Invoke(this, new CollectionChangeEventArgs(CollectionChangeAction.Add, list));
            }
        }
예제 #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());
     }
 }
예제 #11
0
        public void Remove(TreeColumn treeColumn)
        {
            this.List.Remove(treeColumn);

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

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

            // notify count changed
            OnPropertyChanged(CountString);
        }
예제 #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());
            }
        }
예제 #15
0
        protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
        {
            base.OnCollectionChanged(e);
            var eh = CollectionChanged;

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

            if (CollectionChanged != null)
            {
                CollectionChanged.Invoke(Queue, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, file));
            }
        }
예제 #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;
     }
 }
예제 #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
        }
예제 #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);
        }
예제 #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);
        }
 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
         }));
     }
 }
예제 #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);
        }
 protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
 {
     if (suppressNotification)
     {
         return;
     }
     base.OnCollectionChanged(e);
     if (CollectionChanged != null)
     {
         CollectionChanged.Invoke(this, e);
     }
 }
예제 #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);
        }
예제 #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));
            }
        }
예제 #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;
            }
        }