예제 #1
0
 public void subscribe(CountDownClock theClock)
 {
     theClock.TimesUp +=
         (aClock, cd) =>
     {
         Console.WriteLine("Notify: {0}", cd.ToString());
     };
 }
예제 #2
0
 public void subscribe(CountDownClock theClock)
 {
     theClock.TimesUp +=
         (aClock, cd) =>
     {
         Console.WriteLine("Chef go get your toast.");
     };
 }
예제 #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();
        }