Esempio n. 1
0
 /// <summary>
 /// DeRegister the event handler
 /// </summary>
 /// <param name="EventHandler">The event handler.</param>
 public void DeRegister(MessageBusEventHandler EventHandler)
 {
     if (EventHandlers.Contains(EventHandler))
     {
         EventHandlers.Remove(EventHandler);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Registers the specified event handler.
        /// </summary>
        /// <param name="EventHandler">The event handler.</param>
        public void Register(MessageBusEventHandler EventHandler)
        {
            if (EventHandler == null)
            {
                return;
            }

            EventHandlers.Add(EventHandler);
        }
Esempio n. 3
0
        /// <summary>
        /// Registers the specified event handler.
        /// </summary>
        /// <param name="EventHandler">The event handler.</param>
        public void Register(MessageBusEventHandler EventHandler)
        {
            if (EventHandler == null)
            {
                return;
            }

            if (!EventHandlers.Contains(EventHandler))
            {
                EventHandlers.Add(EventHandler);
            }
        }
Esempio n. 4
0
        void postStickyAfterRegistation(MessageBusEventHandler EventHandler)
        {
            MessageBusEvent eventToBePosted = null;

            lock (mStickyEvents)
            {
                if (mStickyEvents.ContainsKey(EventHandler.EventId))
                {
                    // consider using this:
                    // Execute(EventHandler.EventAction, this, mStickyEvents[EventHandler.EventId]);

                    eventToBePosted = mStickyEvents[EventHandler.EventId];
                }
            }

            if (eventToBePosted != null)
            {
                EventHandler.EventAction(this, eventToBePosted);
            }
        }
Esempio n. 5
0
 /// <summary>
 /// DeRegister the event handler
 /// </summary>
 /// <param name="EventHandler">The event handler.</param>
 public void DeRegister(MessageBusEventHandler EventHandler)
 {
     EventHandlers.Remove(EventHandler);
 }
Esempio n. 6
0
        /// <summary>
        /// Registers the sticky event handler. If there is any sticky event waiting, it will be posted immediately.
        /// </summary>
        /// <param name="EventHandler">The event handler.</param>
        public void RegisterSticky(MessageBusEventHandler EventHandler)
        {
            Register(EventHandler);

            postStickyAfterRegistation(EventHandler);
        }