コード例 #1
0
 /// <summary>
 /// Unsubscribes to a channel based on a tag
 /// </summary>
 /// <param name="tag"></param>
 public static void Unsubscribe(string tag)
 {
     foreach (var channel in _channels.Values)
     {
         foreach (var subscription in channel.Keys)
         {
             if (subscription.Tag == tag)
             {
                 channel.TryRemove(subscription, out var _);
                 OnSubscriptionRemoved?.Invoke(null, subscription);
             }
         }
     }
 }
コード例 #2
0
        /// <summary>
        /// Unsubscribes to a channel based on an object owner
        /// </summary>
        /// <param name="owner">The owner object</param>
        public static void Unsubscribe(object owner)
        {
            if (owner == null)
            {
                return;
            }

            foreach (var channel in _channels.Values)
            {
                foreach (var subscription in channel.Keys)
                {
                    if (subscription.Owner == owner)
                    {
                        channel.TryRemove(subscription, out var _);
                        OnSubscriptionRemoved?.Invoke(owner, subscription);
                    }
                }
            }
        }
コード例 #3
0
 private void RaiseOnSubRemoved(ISubscription subscription) => OnSubscriptionRemoved?.Invoke(this, subscription);
コード例 #4
0
 /// <param name="eventName"></param>
 private void RaiseOnEventRemoved(string eventName)
 {
     OnSubscriptionRemoved?.Invoke(this, eventName);
 }