internal static bool FireEvent(Delegate del, object[] args)
{
bool ret = false;
if(null != del)
{
// Invoke the delegates 1 by 1 instead of in linked list
// this gives them each a chance to execute
// By invoking each delegate one by one, we have an
// opportunity to catch an individual exception. That would
// not necessarily be the case if we just did the normal
// delegate execution.
// Also, it gives us an opportunity to log exactly which one
// failed, and continue execution of the others.
Delegate[] sinks = del.GetInvocationList();
foreach(Delegate sink in sinks)
{
// WAA - Reexamine our exception handling. Either turn logging
// back on, or let them bubble up.
try
{
sink.DynamicInvoke(args);
}
catch(Exception e)
{
//eventLog.WriteEntry(string.Format(CultureInfo.CurrentCulture,
// Strings.ErrorCallingAnEventDelegate, e.ToString()), EventLogEntryType.Error,
// (int)RtpEL.ID.Error);
}
}
ret = true;
}
return ret;
}
#endregion FireEvent