Exemplo n.º 1
0
        static void TimerFunc(Delegate d, int miliseconds, int numOfEexcutions)
        {
            for (int i = 0; i < numOfEexcutions; i++)
            {
                Thread.Sleep(miliseconds);
                d();

                Publisher pub1 = new Publisher();
                Subscriber sub1 = new Subscriber("Subscriber", pub1);

                pub1.Notification();

            }
        }
Exemplo n.º 2
0
 public Subscriber(string ID, Publisher pub)
 {
     id = ID;
     // Subscribe to the event
     pub.RaiseCustomEvent += HandleCustomEvent;
 }