Ejemplo n.º 1
0
 /// <summary>
 /// Raises the event.
 /// </summary>
 /// <param name="handler">The delegate to invoke.</param>
 /// <param name="sender">The sender.</param>
 /// <param name="eventArgs">The <see cref="EventArgs"/> instance containing the event data.</param>
 public static void Raise(this Delegate handler, object sender, EventArgs eventArgs)
 {
     if (handler == null)
     {
         return;
     }
     try
     {
         handler.GetMethodInfo()
         .Invoke(handler.Target, new[] { TargetFactory.GetPair(sender), eventArgs });
     }
     catch (TargetInvocationException e)
     {
         throw new TargetInvocationException("Please check the inner exception for error details.", e.InnerException);
     }
 }