Exemple #1
0
 public void ShowEventInfo()
 {
     foreach (Delegate handler in TestEvent.GetInvocationList())
     {
         Console.WriteLine("EventHandler Method = {0}.{1}",
                           handler.Method.DeclaringType, handler.Method.Name);
     }
 }
Exemple #2
0
 public void TestInit()
 {
     if (TestEvent != null)
     {
         foreach (var d in TestEvent.GetInvocationList())
         {
             TestEvent -= (d as EventHandler <AsyncEventArgs>);
         }
     }
 }
Exemple #3
0
 public void ReverseInvocationList()
 {
     Delegate[] handlers = TestEvent.GetInvocationList();
     if (handlers.Length > 0)
     {
         // remove the handlers first
         foreach (EventHandler handler in handlers)
         {
             TestEvent -= handler;
         }
         // reveres the order of the handlers
         Array.Reverse(handlers);
         // now, add the handlers back
         foreach (EventHandler handler in handlers)
         {
             TestEvent += handler;
         }
     }
 }
Exemple #4
0
 public Delegate[] GetInvocationList()
 {
     return(TestEvent != null?TestEvent.GetInvocationList() : new Delegate[0]);
 }