示例#1
0
        static void Main(string[] args)
        {
            var dealer = new CarDealer();

            var michal = new Consumer("Michal");
            var ela    = new Consumer("Ela");
            var kalina = new Consumer("Kalina");

            dealer.NewCarInfo += ela.NewCarIsHere;
            dealer.RaiseNewCarInfo("Honda/Accord");
            Thread.Sleep(3000);

            dealer.NewCarInfo -= michal.NewCarIsHere;
            dealer.NewCarInfo += kalina.NewCarIsHere;
            dealer.RaiseNewCarInfo("Opel/Corsa");
            Thread.Sleep(3000);
            dealer.NewCarInfo -= kalina.NewCarIsHere;
            dealer.NewCarInfo -= ela.NewCarIsHere;


            dealer.RaiseNewCarInfo("Opel/Insignia");
            Thread.Sleep(1000);

            WriteLine("To już koniec...nikt nie czeka!");
        }
示例#2
0
        static void Main(string[] args)
        {
            CarDealer dealer   = new CarDealer();
            Consumer  consumer = new Consumer("志铭");

            dealer.NewCarEvent += consumer.ConsumerReply;

            dealer.RaiseNewCarInfo("BMW");

            Console.ReadKey();
        }