コード例 #1
0
 public void AddNotificationListener(ObjectName name, NotificationCallback callback, NotificationFilterCallback filterCallback, object handback)
 {
     var key = new NotificationSubscriptionKey(name, callback, filterCallback, handback);
     if (_subscriptions.ContainsKey(key))
     {
         throw new InvalidOperationException("Subscription already exists.");
     }
     var pullDeliverySubscription = _eventingClient.SubscribeUsingPullDelivery<TargetedNotificationType>(new Filter(Schema.NotificationDialect, null), new Mandatory(name.CreateSelectorSetHeader()));
     var listener = new PullSubscriptionListener(pullDeliverySubscription, callback, filterCallback, handback);
     _subscriptions.Add(key, listener);
 }
コード例 #2
0
        public void AddNotificationListener(ObjectName name, NotificationCallback callback, NotificationFilterCallback filterCallback, object handback)
        {
            var key = new NotificationSubscriptionKey(name, callback, filterCallback, handback);

            if (_subscriptions.ContainsKey(key))
            {
                throw new InvalidOperationException("Subscription already exists.");
            }
            var pullDeliverySubscription = _eventingClient.SubscribeUsingPullDelivery <TargetedNotificationType>(new Filter(Schema.NotificationDialect, null), new Mandatory(name.CreateSelectorSetHeader()));
            var listener = new PullSubscriptionListener(pullDeliverySubscription, callback, filterCallback, handback);

            _subscriptions.Add(key, listener);
        }
コード例 #3
0
        public override bool Equals(object obj)
        {
            if (!(obj is NotificationSubscriptionKey))
            {
                return(false);
            }
            NotificationSubscriptionKey other = (NotificationSubscriptionKey)obj;

            return(Callback.Equals(other.Callback) &&
                   AreBothNullOrEqual(_filterCallback, other._filterCallback) &&
                   AreBothNullOrEqual(_handback, other._handback) &&
                   ObjectName.Equals(other.ObjectName));
        }
コード例 #4
0
        public void RemoveNotificationListener(ObjectName name, NotificationCallback callback, NotificationFilterCallback filterCallback, object handback)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (callback == null)
            {
                throw new ArgumentNullException("callback");
            }
            var key = new NotificationSubscriptionKey(name, callback, filterCallback, handback);

            PullSubscriptionListener listener;

            if (_subscriptions.TryGetValue(key, out listener))
            {
                _subscriptions.Remove(key);
                listener.Dispose();
            }
        }
コード例 #5
0
        public void RemoveNotificationListener(ObjectName name, NotificationCallback callback, NotificationFilterCallback filterCallback, object handback)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (callback == null)
            {
                throw new ArgumentNullException("callback");
            }
            var key = new NotificationSubscriptionKey(name, callback, filterCallback, handback);

            PullSubscriptionListener listener;
            if (_subscriptions.TryGetValue(key, out listener))
            {
                _subscriptions.Remove(key);
                listener.Dispose();
            }
        }