public SubscriptionEventArgs(Subscription subscription)
 {
     Subscription = subscription;
 }
Esempio n. 2
0
        /// <summary>
        /// Register user with notification channel uri.
        /// </summary>
        /// <param name="userName">The user name to register.</param>
        /// <param name="channelUri">The notification channel uri.</param>
        public void Register(string userName, Uri channelUri)
        {
            if (string.IsNullOrEmpty(userName))
            {
                throw new ArgumentException("Invalid user name", "userName");
            }

            if (channelUri == null)
            {
                throw new ArgumentNullException("channelUri");
            }

            var subscription = new Subscription(userName, channelUri);

            lock (SubscribersSync)
            {
                // Add or update existing.
                _subscribers[userName] = subscription;
            }

            OnSubscribed(new SubscriptionEventArgs(subscription));
        }