Beispiel #1
0
 public InventoryWatcher(InventoryManager inventoryManager)
 {
     Console.WriteLine("[InventoryWatcher.InventoryManager] " +
         "Subscribing to InventoryChange event\n");
     this.inventoryManager = inventoryManager;
     inventoryManager.OnInventoryChageHandler +=
         new InventoryManager.InventoryChangeEventHandler(OnInventoryChange);
 }
Beispiel #2
0
        static void Main(string[] args)
        {
            InventoryManager inventoryManager = new InventoryManager();

            Console.WriteLine("[DelegateEvents.Main] Instantiating subscriber object\n");

            InventoryWatcher inventoryWatch = new InventoryWatcher(inventoryManager);

            inventoryManager.UpdateInventory("111 006 116", -2);

            inventoryManager.UpdateInventory("111 005 383", 5);

            Console.ReadLine();
        }