Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            SimpleEvent eventTrigger = new SimpleEvent();

            Console.WriteLine("Triggering event with no subscribers");
            //eventTrigger.Event(eventTrigger, EventArgs.Empty);
            eventTrigger.EventTrigger();

            eventTrigger.Event += new EventHandler(EventSubscriber);

            // Using delegate inference
            //eventTrigger.Event += EventSubscriber;

            Console.WriteLine("Triggering event with the EventSubscriber subscribed");
            //eventTrigger.Event(eventTrigger, EventArgs.Empty);
            eventTrigger.EventTrigger();

            eventTrigger.AddEventSubscriber();

            Console.WriteLine("Triggering event with two events subscribed");
            //eventTrigger.Event(eventTrigger, EventArgs.Empty);
            eventTrigger.EventTrigger();
        }