示例#1
0
        public void UnRegisterForMessage(ISubscibeMessage subsciber, EapiDataTypes messageType)
        {
            if (SubscriberDic == null)
            {
                return;
            }

            lock (_subscriberSync)
            {
                if (SubscriberDic.ContainsKey(messageType) && SubscriberDic[messageType].Contains(subsciber))
                {
                    SubscriberDic[messageType].Remove(subsciber);
                }
            }
        }
示例#2
0
        public void RegisterForMessage(ISubscibeMessage subsciber, EapiDataTypes messageType)
        {
            if (SubscriberDic == null)
            {
                SubscriberDic = new Dictionary <EapiDataTypes, List <ISubscibeMessage> >();
            }

            lock (_subscriberSync)
            {
                if (SubscriberDic.ContainsKey(messageType))
                {
                    SubscriberDic[messageType].Add(subsciber);
                }
                else
                {
                    var subsciberList = new List <ISubscibeMessage> {
                        subsciber
                    };
                    SubscriberDic[messageType] = subsciberList;
                }
            }
        }