예제 #1
0
 /// <summary>
 /// 取消注册事件处理程序
 /// </summary>
 /// <param name="eventHandler">事件处理程序</param>
 public void DeRegister(MessageBusEventHandler eventHandler)
 {
     if (EventHandlers.Contains(eventHandler))
     {
         EventHandlers.Remove(eventHandler);
     }
 }
예제 #2
0
 /// <summary>
 /// Gets the <see cref="System.Collections.ICollection"/> of
 /// <see cref="Spring.Objects.IEventHandlerValue"/>s for the supplied
 /// event name.
 /// </summary>
 public ICollection this [string eventName]
 {
     get
     {
         return(EventHandlers.Contains(eventName) ?
                EventHandlers [eventName] as ICollection :
                EventValues.EmptyHandlers);
     }
 }
예제 #3
0
 public void AddEventHandler(IEventHandler handler)
 {
     if (handler == null)
     {
         throw new ArgumentNullException(nameof(handler));
     }
     lock (Sync)
         if (!EventHandlers.Contains(handler))
         {
             EventHandlers.Add(handler);
         }
 }
예제 #4
0
        /// <summary>
        /// 注册指定的事件处理程序
        /// </summary>
        /// <param name="eventHandler">事件处理程序</param>
        public void Register(MessageBusEventHandler eventHandler)
        {
            if (eventHandler == null)
            {
                return;
            }

            if (!EventHandlers.Contains(eventHandler))
            {
                EventHandlers.Add(eventHandler);
            }
        }