Example #1
0
 public static void Main()
 {
     Console.WriteLine("---- Calling Main.TestIt ----");
     TestIt();
     Thread.Sleep(5000);
     Console.WriteLine("---- Calling AComponent.TestIt ----");
     AComponent.TestIt();
 }
Example #2
0
        public static void TestIt()
        {
            AComponent obj = new AComponent();

            obj.myEvent += new EventHandler(TestHandler);

            obj.Work();

            Thread.Sleep(1000);

            Console.WriteLine("Trying to unregister handler");
            obj.myEvent -= new EventHandler(TestHandler);
            Console.WriteLine("handler unregistered");
        }