Exemplo n.º 1
0
        /// <summary>
        ///A method to run the subscribed DisplayClockObject method
        /// </summary>
        public static void run()
        {
            ClockObject clk = new ClockObject();

            new DisplayClockObject().subscribe(clk);
            //DisplayClockObject dco = new DisplayClockObject(); dco.subscribe(clk); //also permissible
            clk.run();
            Console.ReadKey();
        }
Exemplo n.º 2
0
 public void timeChange(ClockObject clk, EventArgs t)
 {
     Console.WriteLine("The new time values are (month), (day) and (second): {0}:{1}:{2}", clk.Month, clk.Day, clk.Second);
 }
Exemplo n.º 3
0
 public void subscribe(ClockObject clk)
 {
     clk.secondChanged += timeChange; //made static to enable referencing
     //theClock.secondChanged += new Clock.SecondChangedHandler(timeHasChanged); This is the same
 }