Ejemplo n.º 1
0
        private void SubscriptionDisposing(Subscription subscription, string key)
        {
            subscription.Disposing -= SubscriptionDisposing;
            if (Subscriptions.ContainsKey(subscription))
            {
                var observer = Subscriptions[subscription];
                var count    = Subscriptions.Count(x => x.Key.SubscriptionKey == key);

                Subscriptions.Remove(subscription);
                SubscriptionRemoved?.Invoke(this, observer, key);
            }
        }
Ejemplo n.º 2
0
 private void SubscriptionRemovedInternal <T>(KeySubscriptionContainer <T> container, T observer, string key) where T : class
 {
     if (SubscriptionRemoved != null)
     {
         var count = container.Count(key);
         if (container.Count() == 0)
         {
             container.SubscriptionRemoved -= SubscriptionRemovedInternal;
             Containers.Remove(container);
         }
         var arg = new SubscriptionArg(key, count, observer);
         SubscriptionRemoved?.Invoke(arg);
     }
 }
Ejemplo n.º 3
0
 protected virtual void RaiseSubscriptionRemoved(WampSubscriptionRemoveEventArgs e)
 {
     SubscriptionRemoved?.Invoke(this, e);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Event invocator for the <see cref="SubscriptionRemoved"/> event
 /// </summary>
 /// <param name="subscription">The removed subscription</param>
 private void OnSubscriptionRemoved(Subscription subscription)
 {
     SubscriptionRemoved?.Invoke(this, subscription);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Raises the <see cref="E:SubscriptionRemoved" /> event.
 /// </summary>
 /// <param name="e">The <see cref="SubscriptionEventArgs"/> instance containing the event data.</param>
 protected internal virtual void OnSubscriptionRemoved(SubscriptionEventArgs e)
 {
     SubscriptionRemoved?.Invoke(this, e);
 }
Ejemplo n.º 6
0
        public void Unsubscribe <TEvent>() where TEvent : Event
        {
            _subscriptions.Remove(typeof(TEvent));

            SubscriptionRemoved?.Invoke(typeof(TEvent));
        }
Ejemplo n.º 7
0
 public void Unsubscribe(Subscription subscription)
 {
     _subscriptions.TryRemove(subscription.Topic, out Subscription _);
     SubscriptionRemoved?.Invoke(this, new SubscriptionEventArgs(subscription));
 }