/// <summary> /// Dispatches the message to the appropiate handler for the given message. /// </summary> /// <param name="e"></param> public void DispatchEvent(PsEvent e) { Delegate handler = _handlers[e.Type.Name]; if (handler != null) handler.DynamicInvoke(new object[] { e }); }
/// <summary> /// Will either send the message or queue it for later delivery. /// </summary> /// <param name="message"></param> private void SendMessage(PsEvent message) { if (QueueMessages) _eventQueue.Enqueue(message); else _dispatcher.DispatchEvent(message); }