Esempio n. 1
0
        static void Main(string[] args)
        {
            EventPublisher publisher = new EventPublisher();
            EventSubscriber subscriber = new EventSubscriber(publisher);
            subscriber.Start();
           
            ////Wiring up the subscriber and publisher relationship
            // You cannot do it here
            //publisher.action1Happened += subscriber.Action1CallBack(publisher, "Action1 handled by subscriber");
            //publisher.action2Happened += subscriber.Action2CallBack(publisher, "Action2 handled by subscriber");

            //publisher.action1Happened -= subscriber.Action1CallBack(publisher, "Action1 handled by subscriber");
            //publisher.action2Happened -= subscriber.Action2CallBack(publisher, "Action2 handled by subscriber");

        }
Esempio n. 2
0
 public EventSubscriber(EventPublisher publisher) 
 {
     this.publishertoSubscribeTo = publisher;
 }