コード例 #1
0
        /// <summary>
        /// Removes the subscription from the state.
        /// </summary>
        /// <param name="subscription">The subscription to remove</param>
        /// <seealso cref="StateSubscription"/>
        public void RemoveSubscription(StateSubscription subscription)
        {
            subscriptions.Remove(subscription);

            if (subscription.Active)
            {
                subscription.Unsubscribe();
            }
        }
コード例 #2
0
        /// <summary>
        /// Adds the subscription to the state.
        /// </summary>
        /// <param name="subscription">The subscription to add.</param>
        /// <param name="subscribe">If set to <c>true</c> subscription is automatically subscribed.</param>
        /// <seealso cref="StateSubscription"/>
        public void AddSubscription(StateSubscription subscription, bool subscribe = false)
        {
            subscriptions.Add(subscription);

            if (subscribe)
            {
                subscription.Subscribe();
            }
        }