protected virtual void OnExpired(InventoryEventArgs e) { if (Expired != null) { Expired(this, e); } }
protected virtual void OnRemoved(InventoryEventArgs e) { if (Removed != null) { Removed(this, e); } }
private static void ManagerOnRemoved(object sender, InventoryEventArgs inventoryEventArgs) { //Once the item is removed, our event listener will display that it was removed. Console.WriteLine("Removed item {0}.", inventoryEventArgs.InventoryItem.Label); }
private static void ManagerOnExpired(object sender, InventoryEventArgs inventoryEventArgs) { //When an item expires, display the label of the expired item and remove it from inventory. Console.WriteLine("Item {0} expired. Requesting removal....", inventoryEventArgs.InventoryItem.Label); manager.Remove(inventoryEventArgs.InventoryItem.Label); }