Exemple #1
0
 public void subscribe(CountDownClock theClock)
 {
     theClock.TimesUp += delegate(object CountDownClock, CountDownEventArgs cd)
     {
         Console.WriteLine("Notify: {0}", cd.ToString());
     };
 }
Exemple #2
0
 public void subscribe(CountDownClock theClock)
 {
     theClock.TimesUp += delegate(object CountDownClock, CountDownEventArgs cd)
     {
         Console.WriteLine("Chef go get your toast.");
     };
 }
Exemple #3
0
        public void Run()
        {
            CountDownClock toasterCountDown = new CountDownClock("Toasts are ready to serve", 30);

            Toaster     toaster = new Toaster();
            ToasterChef chef    = new ToasterChef();

            toaster.subscribe(toasterCountDown);
            chef.subscribe(toasterCountDown);

            toasterCountDown.Run();
        }