Esempio n. 1
0
        /// <summary>
        ///   Removes the range.
        /// </summary>
        /// <param name = "items">The items.</param>
        public virtual void RemoveRange(IEnumerable <T> items)
        {
            Execute.OnUIThread(() =>
            {
                var previousNotificationSetting = IsNotifying;
                IsNotifying = false;
                foreach (var item in items)
                {
                    var index = IndexOf(item);
                    if (index >= 0)
                    {
                        RemoveItemBase(index);
                    }
                }
                IsNotifying = previousNotificationSetting;

                OnPropertyChanged(new PropertyChangedEventArgs("Count"));
                OnPropertyChanged(new PropertyChangedEventArgs("Item[]"));
                OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
            });
        }
Esempio n. 2
0
 /// <summary>
 ///   Clears the items contained by the collection.
 /// </summary>
 protected override sealed void ClearItems()
 {
     Execute.OnUIThread(ClearItemsBase);
 }
Esempio n. 3
0
 /// <summary>
 ///   Sets the item at the specified position.
 /// </summary>
 /// <param name = "index">The index to set the item at.</param>
 /// <param name = "item">The item to set.</param>
 protected override sealed void SetItem(int index, T item)
 {
     Execute.OnUIThread(() => SetItemBase(index, item));
 }
Esempio n. 4
0
 /// <summary>
 ///   Removes the item at the specified position.
 /// </summary>
 /// <param name = "index">The position used to identify the item to remove.</param>
 protected override sealed void RemoveItem(int index)
 {
     Execute.OnUIThread(() => RemoveItemBase(index));
 }
Esempio n. 5
0
 /// <summary>
 /// Moves the item within the collection.
 /// </summary>
 /// <param name="oldIndex">The old position of the item.</param>
 /// <param name="newIndex">The new position of the item.</param>
 protected sealed override void MoveItem(int oldIndex, int newIndex)
 {
     Execute.OnUIThread(() => MoveItemBase(oldIndex, newIndex));
 }