Exemplo n.º 1
0
        public void RegisterListener(WcfEvents.EventName eventName, ServiceConfigurations.ServiceName listenerName)
        {
            Console.WriteLine("{0}: listens to: [{2}] and [{1}Event]", listenerName, eventName, GetType().Name);
            var eventType = WcfEvents.GetEventType(eventName);

            if (!eventType.IsSubclassOf(typeof(BaseEvent)))
            {
                throw new Exception("Invalid event registration");
            }

            if (!ListenerIds.ContainsKey(eventName))
            {
                ListenerIds[eventName] = new List <ServiceConfigurations.ServiceName> {
                    listenerName
                };
                return;
            }

            ListenerIds[eventName].Add(listenerName);
        }