Esempio n. 1
0
        public static void Weak_Events()
        {
            CozyDealer dealer = new CozyDealer();

            WeakCozyConsumer consumerZ = new WeakCozyConsumer("zapline");

            WeakCozyEventManager.AddListener(dealer, consumerZ);
            dealer.NewCozyEvent("hello");

            WeakCozyConsumer consumerK = new WeakCozyConsumer("kingwl");

            WeakCozyEventManager.AddListener(dealer, consumerK);
            dealer.NewCozyEvent("hi");

            WeakCozyEventManager.RemoveListener(dealer, consumerZ);
            dealer.NewCozyEvent("hehe");
        }
Esempio n. 2
0
        public static void Weak_Events()
        {
            CozyDealer dealer = new CozyDealer();

            WeakCozyConsumer consumerZ = new WeakCozyConsumer("zapline");
            WeakCozyEventManager.AddListener(dealer, consumerZ);
            dealer.NewCozyEvent("hello");

            WeakCozyConsumer consumerK = new WeakCozyConsumer("kingwl");
            WeakCozyEventManager.AddListener(dealer, consumerK);
            dealer.NewCozyEvent("hi");

            WeakCozyEventManager.RemoveListener(dealer, consumerZ);
            dealer.NewCozyEvent("hehe");
        }