Example #1
0
        public void run()
        {
            pub = new Publisher();
            Subscriber sub = new Subscriber(pub);

            // Create a timer
            Timer myTimer = new System.Timers.Timer();
            // Tell the timer what to do when it elapses
            myTimer.Elapsed += new ElapsedEventHandler(myEvent);
            // Set it to go off every five seconds
            myTimer.Interval = 5000;
            // And start it
            myTimer.Enabled = true;
        }
Example #2
0
 // Define what actions to take when the event is raised.
 void HandleCustomEvent(Object sender, Publisher.CustomEventArgs e)
 {
     Console.WriteLine("HEARD IT AT {0}", e.TimeReached);
 }
Example #3
0
 public Subscriber(Publisher pub)
 {
     pub.RaiseCustomEvent += HandleCustomEvent;
 }