/// <summary> /// 触发事件, 带4个参数触发 /// </summary> /// <param name="eventType"></param> /// <param name="handler"></param> public void TriggerEvent <T, U, V, W>(string eventType, T arg1, U arg2, V arg3, W arg4) { #if LOG_ALL_MESSAGES || LOG_BROADCAST_MESSAGE DebugUtil.Info("MESSENGER\t" + System.DateTime.Now.ToString("hh:mm:ss.fff") + "\t\t\tInvoking \t\"" + eventType + "\""); #endif Delegate d = GetDelegate(eventType); if (d == null) { return; } var callbacks = d.GetInvocationList(); for (int i = 0; i < callbacks.Length; i++) { Action <T, U, V, W> callback = callbacks[i] as Action <T, U, V, W>; if (callback == null) { throw new EventException(string.Format("TriggerEvent {0} error: types of parameters are not match.", eventType)); } try { callback(arg1, arg2, arg3, arg4); } catch (Exception ex) { DebugUtil.Except(ex); } } }