static public void Broadcast(string eventType, MessengerMode mode) { MessengerInternal.OnBroadcasting(eventType, mode); var invocationList = MessengerInternal.GetInvocationList <Action>(eventType); //получим список всех Action-делегатов (без параметров) по событию if (invocationList != null) //фиксы от Арти { foreach (Action callback in invocationList) { callback.Invoke(); //запускаем все из полученного списка } } MessengerInternalSpecial.OnBroadcasting(eventType, mode); var invocationList2 = MessengerInternalSpecial.GetInvocationList <Action <string> >(eventType); if (invocationList2 != null)//фиксы от Арти { foreach (var callback in invocationList2) { callback.Invoke(eventType); } } }
static public void Broadcast <TReturn>(string eventType, Action <TReturn> returnCall, MessengerMode mode) { MessengerInternal.OnBroadcasting(eventType, mode); var invocationList = MessengerInternal.GetInvocationList <Func <TReturn> >(eventType); if (invocationList != null)//фиксы от Арти { foreach (var result in invocationList.Select(del => del.Invoke()).Cast <TReturn>()) { returnCall.Invoke(result); } } MessengerInternalSpecial.OnBroadcasting(eventType, mode); var invocationList2 = MessengerInternalSpecial.GetInvocationList <Func <string, TReturn> >(eventType); if (invocationList2 != null)//фиксы от Арти { foreach (var result in invocationList2.Select(del => del.Invoke(eventType)).Cast <TReturn>()) { returnCall.Invoke(result); } } }