Exemple #1
0
        public void Unsubscribe(global::System.Type messageType, PublishedMessageHandler messageHandler)
        {
            // TODO: This will probably throw an exception if no one has subscribed
            // to the message before
            PublishedMessageHandler handler = _messageHandlers[messageType];

            handler -= messageHandler;
            if (handler == null)
            {
                _messageHandlers.Remove(messageType);
            }
        }
Exemple #2
0
        public void Subscribe(global::System.Type messageType, PublishedMessageHandler messageHandler)
        {
            PublishedMessageHandler handler = null;

            if (!_messageHandlers.TryGetValue(messageType, out handler))
            {
                handler += messageHandler;
                _messageHandlers.Add(messageType, handler);
            }
            else
            {
                handler += messageHandler;
            }
        }