public void OnBatchAfter(System.Collections.Generic.IEnumerable <S> senders, T eventArgs) { BatchEventHandler <S, T> batchEventHandler = EventBus <S, T> .Handlers[this.EventHandlerKey_BatchAfter] as BatchEventHandler <S, T>; if (batchEventHandler != null) { System.Delegate[] invocationList = batchEventHandler.GetInvocationList(); System.Delegate[] array = invocationList; for (int i = 0; i < array.Length; i++) { BatchEventHandler <S, T> batchEventHandler2 = (BatchEventHandler <S, T>)array[i]; try { batchEventHandler2.BeginInvoke(senders, eventArgs, null, null); } catch (System.Exception exception) { LoggerFactory.GetLogger().Log(LogLevel.Error, exception, "执行触发批量操作执行后事件时发生异常"); } } } }
/// <summary> /// 触发批量操作执行后事件 /// </summary> /// <param name="senders">触发事件的对象集合</param> /// <param name="eventArgs">事件参数</param> public void OnBatchAfter(IEnumerable <S> senders, T eventArgs) { BatchEventHandler <S, T> handler = Handlers[EventHandlerKey_BatchAfter] as BatchEventHandler <S, T>; if (handler != null) { //获取事件中的多路委托列表 Delegate[] delegateArray = handler.GetInvocationList(); foreach (BatchEventHandler <S, T> dele in delegateArray) { try { dele.BeginInvoke(senders, eventArgs, null, null); } catch (Exception e) { LoggerFactory.GetLogger().Log(LogLevel.Error, e, "执行触发批量操作执行后事件时发生异常"); } } } }