private static bool SaveCurrentChannel(ConnectedChannelInfo clientInformation)
        {
            try
            {
                if (clientInformation == null)
                {
                    throw new ArgumentNullException();
                }
                ConnectedChannelInfo client = GetClientByChannelId(clientInformation);
                if (client != null)
                {
                    DicClients.Remove(client);
                }

                DicClients.Add(clientInformation, CallbackChannel);

                return(true);
            }
            catch (ArgumentNullException)
            {
                return(false);
            }
            catch (ArgumentException)
            {
                return(false);
            }
        }
 public bool RemoveSubscriber(ConnectedChannelInfo subscriberInformation)
 {
     if (subscriberInformation == null)
     {
         throw new ArgumentNullException();
     }
     return(RemoveCurrentChannel(subscriberInformation));
 }
Example #3
0
 private void SubscribeToService()
 {
     if (ChannelId != null)
     {
         var clientInfo = new ConnectedChannelInfo {
             ChannelId = ChannelId.Value, ChannelName = "Test PC " + ChannelId.ToString()
         };
         serviceConnectionInitialization.SubscribeToService(clientInfo);
     }
 }
        public IPubSubClientCallback GetSpesificSubscriberChannel(ConnectedChannelInfo subscriberInformation)
        {
            if (subscriberInformation == null)
            {
                throw new ArgumentNullException();
            }
            ConnectedChannelInfo client = DicClients.Keys.FirstOrDefault(x => x.ChannelId == subscriberInformation.ChannelId);

            if (client != null)
            {
                return(DicClients[client]);
            }
            return(null);
        }
Example #5
0
 public bool Unsubscribe(ConnectedChannelInfo connectedChannelInfo)
 {
     return(subscribersManagement.RemoveSubscriber(connectedChannelInfo));
 }
Example #6
0
 public bool Subscribe(ConnectedChannelInfo connectedChannelInfo)
 {
     return(subscribersManagement.AddSubscriber(connectedChannelInfo));
 }
Example #7
0
 public void SubscribeToService(ConnectedChannelInfo SubscriberInformation)
 {
     _serviceWrapper.Channel.Subscribe(SubscriberInformation);
 }
 private static ConnectedChannelInfo GetClientByChannelId(ConnectedChannelInfo subscriberInformation)
 {
     return(DicClients.Keys.FirstOrDefault(x => x.ChannelId == subscriberInformation.ChannelId));
 }