示例#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");
        }
示例#2
0
文件: G3Event.cs 项目: xxy1991/cozy
        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");
        }