Exemplo n.º 1
0
        private void Run()
        {
            Events = new EventHolder();
            var c1 = new Client1(Events);
            var c2 = new Client2(Events);

            Console.WriteLine("Invoking all events...");
            InvokeEvents();

            c2.RemoveInitialize();
            Console.WriteLine("RemoveInitialize and invoking...");
            InvokeEvents();

            c2.AddInitialize();
            Console.WriteLine("AddInitialize and invoking...");
            InvokeEvents();

            c2.RemoveTerminate();
            Console.WriteLine("RemoveTerminate and invoking...");
            InvokeEvents();

            c2.AddTerminate();
            Console.WriteLine("AddTerminate and invoking...");
            InvokeEvents();
        }
Exemplo n.º 2
0
        private void Run()
        {
            Events = new EventHolder();
            var c1 = new Client1(Events);
            var c2 = new Client2(Events);

            Console.WriteLine("Invoking all events...");
            InvokeEvents();

            c2.RemoveInitialize();
            Console.WriteLine("RemoveInitialize and invoking...");
            InvokeEvents();

            c2.AddInitialize();
            Console.WriteLine("AddInitialize and invoking...");
            InvokeEvents();

            c2.RemoveTerminate();
            Console.WriteLine("RemoveTerminate and invoking...");
            InvokeEvents();

            c2.AddTerminate();
            Console.WriteLine("AddTerminate and invoking...");
            InvokeEvents();
        }
Exemplo n.º 3
0
 public Client1(EventHolder events)
 {
     events.Initialize += InitializeHandler;
     events.Terminate  += TerminateHandler;
 }
Exemplo n.º 4
0
 public Client2(EventHolder events)
 {
     Events = events;
     AddInitialize();
     AddTerminate();
 }
Exemplo n.º 5
0
 public Client2(EventHolder events)
 {
     Events = events;
     AddInitialize();
     AddTerminate();
 }
Exemplo n.º 6
0
 public Client1(EventHolder events)
 {
     events.Initialize += InitializeHandler;
     events.Terminate += TerminateHandler;
 }