/// <inheritdoc />
        public void RemoveAt(int index)
        {
            var item = this[index];

            RemovingItem?.Invoke(item);
            ListAction(x => x.RemoveAt(index));
            RemovedItem?.Invoke(item);
        }
        /// <inheritdoc />
        public bool Remove(T item)
        {
            RemovingItem?.Invoke(item);
            var removed = ListFunc(x => x.Remove(item));

            RemovedItem?.Invoke(item);
            return(removed);
        }
示例#3
0
 public override void Remove(ListViewItem item)
 {
     if (!noEvents)
     {
         RemovingItem?.Invoke(this, item);
     }
     base.Remove(item);
     if (!noEvents)
     {
         RemovedItem?.Invoke(this, item);
     }
 }
        private void HandleRemovedTanks(IXQueryable[] removedTanks)
        {
            foreach (var tank in removedTanks)
            {
                var item = new RemovedItem(PatchnoteGeneratorDocumenVM.GetTankName(tank), tank);
                item.ItemName.AddModifier(this.GetTankTypeModifier(tank));
                _removedTanks.Add(item);

                ++_processedTankTaskCount;
                this.GenerationProgress = (double)_processedTankTaskCount / _tankTaskCount;
            }
        }
        /// <summary>
        /// Clears the Bidirectional List of its Items. This operation is a bit expensive
        /// because a local collection must be maintained in order to properly connect the
        /// callback methods.
        /// </summary>
        /// <inheritdoc />
        public void Clear()
        {
            // We need to maintain a Local Collection for this one.
            var clearing = new List <T>(Collection);

            void ReportClearing(BidirectionalListItemCallback <T> callback)
            {
                foreach (var x in clearing)
                {
                    callback.Invoke(x);
                }
            }

            ReportClearing(x => RemovingItem?.Invoke(x));
            ListAction(x => x.Clear());
            ReportClearing(x => RemovedItem?.Invoke(x));
        }
        /// <summary>
        /// Removes a customer item cache line item
        /// </summary>
        /// <param name="sku">
        /// The SKU.
        /// </param>
        public void RemoveItem(string sku)
        {
            var lineItem = _itemCache.Items[sku];

            if (lineItem == null)
            {
                return;
            }

            if (RemovingItem.IsRaisedEventCancelled(new DeleteEventArgs <ILineItem>(lineItem), this))
            {
                return;
            }

            LogHelper.Debug <CustomerItemCacheBase>("Before Attempting to remove - count: " + _itemCache.Items.Count);
            LogHelper.Debug <CustomerItemCacheBase>("Attempting to remove sku: " + sku);

            _itemCache.Items.RemoveItem(sku);

            RemovedItem.RaiseEvent(new DeleteEventArgs <ILineItem>(lineItem), this);
            LogHelper.Debug <CustomerItemCacheBase>("After Attempting to remove - count: " + _itemCache.Items.Count);
        }