public static void Run()
        {
            ClockPublisher  publisher  = new ClockPublisher();
            ClockSubscriber subscriber = new ClockSubscriber();

            subscriber.Susbscribe(publisher);
            publisher.Run();
        }
Ejemplo n.º 2
0
        public static void Main()
        {
            ClockPublisher clock = new ClockPublisher();

            ISubscriber dc = new DisplayClock(clock);
            ISubscriber lc = new LogClock(clock);

            lc.AddSubscriber();                   // subscribe for event
            dc.AddSubscriber();                   // subscribe for event

            clock.GetUpdatedTimeOnSecondChange(); // publish event

            Console.ReadKey();
        }
Ejemplo n.º 3
0
 public LogClock(ClockPublisher clock)
 {
     _clock = clock;
 }
Ejemplo n.º 4
0
 public DisplayClock(ClockPublisher clock)
 {
     _clock = clock;
 }