public void AddToPack(Item item) { if (Inventory.Count <= _capacity) { AdditionalItem.Invoke(item); Inventory.Add(item); } }
/// <summary> /// Raises event 'AddItem' /// </summary> protected virtual void OnAddItem() { if (AddItem != null) { AddItem.Invoke(this, System.EventArgs.Empty); } }
// Adds obj to the tail of the queue. public virtual void Enqueue(T item) { _list[_tail] = item; _tail = (_tail + 1) % _list.Count; _size++; AddItem?.Invoke(this, new MyEventArgs <T>(new object[1] { item })); }
private void AddCommandBinding_Executed(object sender, ExecutedRoutedEventArgs e) { AddItemEventArgs e2; e2 = new AddItemEventArgs(); AddItem?.Invoke(this, e2); if (e2.AddedItem != null) { SelectedItem = ItemsSource.Add(e2.AddedItem); } }
public void Create() { var sequence = new SequenceBase(); sequence.AddItem += (sender, o) => { m_animator.Stop(); AddItem?.Invoke(this, o); }; Sequences.Insert(0, sequence); }
public async virtual void Add(SequenceBaseObject item) { Items.Add(item); item.Commit += OnItemCommit; item.Loaded += (sender) => { AddItem?.Invoke(this, sender); }; await item.Load(); }
/// <summary> /// Add a new item. /// If the item already exists - ignore it /// If the item was removed, put it in the item list again /// </summary> /// <param name="item">Item to add</param> public void Add(T item) { // If the item is not added to any list yet if (removedItems.Contains(item)) { var args = new AddItemEventArgs { Item = item, ReaddFromRemovedItems = true }; AddItem?.Invoke(this, args); if (!args.Cancel) { newItems.Add(item); // Remove item from the list of removed items items.Add(item); removedItems.Remove(item); var itemAdded = new ItemAddedEventArgs { Item = item }; ItemAdded?.Invoke(this, itemAdded); } } else if (!items.Contains(item) && !newItems.Contains(item)) { var args = new AddItemEventArgs { Item = item }; AddItem?.Invoke(this, args); if (!args.Cancel) { newItems.Add(item); var itemAdded = new ItemAddedEventArgs { Item = item }; ItemAdded?.Invoke(this, itemAdded); } } }
private void OnInventoryItemRightClicked(InventoryItem inventoryItem) { AddItem?.Invoke(inventoryItem.Item); }
public void OnAddItem(object sender, string name) { AddItem?.Invoke(sender, new AddItemEventArgs { Name = name }); }
new void Add(T item) { AddItem?.Invoke(); base.Add(item); }
private void AddClick(object sender, RoutedEventArgs e) { AddItem?.Invoke(); }
private void AddItemBtn_Click(object sender, EventArgs e) { AddItem?.Invoke(this, EventArgs.Empty); }
protected virtual void OnAddItem(CreateManagerItem obj) { AddItem?.Invoke(obj); }
protected virtual void AddItemEvent() { AddItem?.Invoke(this, EventArgs.Empty); }
public static void OnAddItem(Item item) { AddItem?.Invoke(item); }
protected virtual void OnAddItem(IGameObject obj) { AddItem?.Invoke(obj); }