private void HandleAddedTanks(IXQueryable[] addedTanks)
        {
            foreach (var tank in addedTanks)
            {
                var item = new AddedItem(PatchnoteGeneratorDocumenVM.GetTankName(tank), tank);
                item.ItemName.AddModifier(this.GetTankTypeModifier(tank));
                _addedTanks.Add(item);

                ++_processedTankTaskCount;
                this.GenerationProgress = (double)_processedTankTaskCount / _tankTaskCount;
            }
        }
Ejemplo n.º 2
0
        private void HandleAddedTanks(IXQueryable[] addedTanks)
        {
            foreach (var tank in addedTanks)
            {
                var item = new AddedItem(tank["userString"], tank);
                item.ItemName.AddModifier(this.GetTankTypeModifier(tank));
                _addedTanks.Add(item);

                ++_processedTankTaskCount;
                this.GenerationProgress = (double)_processedTankTaskCount / _tankTaskCount;
            }
        }
Ejemplo n.º 3
0
        public override ListViewItem Add(ListViewItem value)
        {
            if (!noEvents)
            {
                AddingItem?.Invoke(this, value);
            }
            var o = base.Add(value);

            if (!noEvents)
            {
                AddedItem?.Invoke(this, value);
            }
            return(o);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// アイテムを追加する
        /// </summary>
        public void AddItem(MasterDataItem.Record item, int amount)
        {
            var itemId = item.Id;

            if (this.items.ContainsKey(itemId))
            {
                this.items[itemId] += amount;
            }
            else
            {
                this.items.Add(itemId, amount);
            }

            Broker.Global.Publish(AddedItem.Get(this, item, amount));
        }
Ejemplo n.º 5
0
        /// <inheritdoc />
        /// <summary>
        ///     Adds an item to the <see cref="T:System.Collections.Generic.ICollection`1"></see>.
        /// </summary>
        /// <param name="item">The object to add to the <see cref="T:System.Collections.Generic.ICollection`1"></see>.</param>
        public void Add(T item)
        {
            AddingItemEventArgs <T> addingItemEventArgs = new AddingItemEventArgs <T>(item);

            AddingItem?.Invoke(this, addingItemEventArgs);
            if (addingItemEventArgs.Cancel)
            {
                return;
            }

            _items.Add(item);

            AddedItemEventArgs <T> addedItemEventArgs = new AddedItemEventArgs <T>(addingItemEventArgs.Item);

            AddedItem?.Invoke(this, addedItemEventArgs);
        }
        /// <summary>
        /// Adds a line item to the customer item cache.
        /// </summary>
        /// <param name="lineItem">
        /// The <see cref="IItemCacheLineItem"/>.
        /// </param>
        public void AddItem(IItemCacheLineItem lineItem)
        {
            if (lineItem.Quantity <= 0)
            {
                lineItem.Quantity = 1;
            }
            if (lineItem.Price < 0)
            {
                lineItem.Price = 0;
            }

            if (AddingItem.IsRaisedEventCancelled(new Core.Events.NewEventArgs <ILineItem>(lineItem), this))
            {
                return;
            }

            _itemCache.AddItem(lineItem);

            AddedItem.RaiseEvent(new Core.Events.NewEventArgs <ILineItem>(lineItem), this);
        }
Ejemplo n.º 7
0
        public void Add(int itemHash, int number)
        {
            Assert.IsTrue(number >= 1);
            if (!this.Items.ContainsKey(itemHash))
            {
                this.Items.Add(itemHash, 0);
            }

            this.Items[itemHash] += number;

            var itemSpecs = GameController.Instance.ItemSpecs;
            var item      = itemSpecs.Get(itemHash);

            if (item.AddedInventoryTask != null)
            {
                item.AddedInventoryTask.Do();
            }
            UniRxEvent.GlobalBroker.Publish(AddedItem.Get(item));
            Debug.Log(string.Format("{0} x {1}", item.Name, this.Items[itemHash]));
        }
Ejemplo n.º 8
0
        public async Task <ActionResult> Create(IFormCollection formCollection)
        {
            if (ModelState.IsValid)
            {
                //Save new AddInventoryModel
                AddInventoryModel addInventoryModel = new AddInventoryModel();
                addInventoryModel.UserName = User.Identity.Name;
                addInventoryModel.Date     = DateTime.Now;
                _context.Add(addInventoryModel);
                await _context.SaveChangesAsync();

                //Save new AddedItems to AddInventoryModel and update DB with new quantities
                var inventory = _context.InventoryItem;

                foreach (var _key in formCollection.Keys)
                {
                    if (_key != "__RequestVerificationToken")
                    {
                        var item   = inventory.Find(Convert.ToInt32(_key));
                        int addQty = Convert.ToInt32(formCollection[_key]);

                        //Add addedItem to _context and populate AddedItems
                        AddedItem addedItem = new AddedItem();
                        addedItem.AddInventoryModelId = addInventoryModel.ID;
                        addedItem.InventoryItemId     = item.ID;
                        addedItem.Quantity            = addQty;
                        _context.Add(addedItem);

                        //Update InventoryItem new StockQty
                        item.StockQty += addQty;
                    }
                }

                await _context.SaveChangesAsync();

                return(Redirect("../InventoryItems"));
            }

            return(RedirectToAction("AddInventory/Create"));
        }
        /// <summary>
        /// Constructs a <see cref="IBidirectionalList{T}"/> given <paramref name="values"/>.
        /// </summary>
        /// <param name="values"></param>
        /// <param name="onAdded"></param>
        /// <param name="onRemoved"></param>
        /// <param name="onAdding"></param>
        /// <param name="onRemoving"></param>
        public BidirectionalList(IList <T> values
                                 , BidirectionalListItemCallback <T> onAdded
                                 , BidirectionalListItemCallback <T> onRemoved
                                 , BidirectionalListItemCallback <T> onAdding   = null
                                 , BidirectionalListItemCallback <T> onRemoving = null)
        {
            var defaultItemCallback = DefaultItemCallback;

            // Connect the Bidirectional Item callback conditionally when there is a Callback.
            void ConnectBidiCallback(BidirectionalListItemCallback <T> callback
                                     , Action <BidirectionalList <T>, BidirectionalListItemCallback <T> > onConnect)
            {
                if (callback != null)
                {
                    onConnect.Invoke(this, callback);
                }
            }

            ConnectBidiCallback(onAdded, (x, callback) => x.AddedItem       += callback);
            ConnectBidiCallback(onAdding, (x, callback) => x.AddingItem     += callback);
            ConnectBidiCallback(onRemoved, (x, callback) => x.RemovedItem   += callback);
            ConnectBidiCallback(onRemoving, (x, callback) => x.RemovingItem += callback);

            // Effectively we are also Adding the items to the initial Collection instance.
            foreach (var x in values)
            {
                AddingItem?.Invoke(x);
            }

            Collection = values;

            foreach (var x in values)
            {
                AddedItem?.Invoke(x);
            }
        }
        /// <summary>
        /// Constructs a <see cref="IBidirectionalList{T}"/> given <paramref name="values"/>.
        /// </summary>
        /// <param name="values"></param>
        /// <param name="onAdded"></param>
        /// <param name="onRemoved"></param>
        /// <param name="onAdding"></param>
        /// <param name="onRemoving"></param>
        public BidirectionalList(IList <T> values
                                 , BidirectionalListItemCallback <T> onAdded    = null
                                 , BidirectionalListItemCallback <T> onRemoved  = null
                                 , BidirectionalListItemCallback <T> onAdding   = null
                                 , BidirectionalListItemCallback <T> onRemoving = null)
        {
            AddedItem    += onAdded ?? DefaultCallback();
            AddingItem   += onAdding ?? DefaultCallback();
            RemovedItem  += onRemoved ?? DefaultCallback();
            RemovingItem += onRemoving ?? DefaultCallback();

            // Effectively we are also Adding the items to the initial Collection instance.
            foreach (var x in values)
            {
                AddingItem?.Invoke(x);
            }

            _collection = values;

            foreach (var x in values)
            {
                AddedItem?.Invoke(x);
            }
        }
Ejemplo n.º 11
0
 private void OnItemAdded(ScriptableItem item) => AddedItem?.Invoke(item);
 public void Add(T item)
 {
     internalList.Add(item);
     AddedItem.Invoke(item);
 }
 /// <inheritdoc />
 public void Insert(int index, T item)
 {
     AddingItem?.Invoke(item);
     ListAction(x => x.Insert(index, item));
     AddedItem?.Invoke(item);
 }
 /// <inheritdoc />
 public void Add(T item)
 {
     AddingItem?.Invoke(item);
     ListAction(x => x.Add(item));
     AddedItem?.Invoke(item);
 }
Ejemplo n.º 15
0
 protected void ProcessItemAdded(IntelItem intelItem)
 {
     IntelItems.Enqueue(intelItem);
     AddedItem?.Invoke(this, intelItem);
 }