コード例 #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");
        }