Exemplo n.º 1
0
        /// <summary>
        /// The Disconnect operation just grabs the Callback Channel of the
        /// client and attempts to remove the channel from the list
        /// </summary>
        public void Disconnect()
        {
            IDuplexCallBack callbackChannel =
                OperationContext.Current.GetCallbackChannel <IDuplexCallBack>();

            try
            {
                lock (_sycnRoot)
                {
                    if (_callbackChannels.Remove(callbackChannel))
                    {
                        Console.WriteLine("Removed Callback Channel: {0}", callbackChannel.GetHashCode());
                    }
                }
            }
            catch
            {
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// The Connect operation grabs the Callback Channel of the client and
        /// checks if it is not already stored in the Callback Channel list –
        /// if not then it is added to the list.
        /// </summary>

        public void Connect()
        {
            try
            {
                IDuplexCallBack callbackChannel =
                    OperationContext.Current.GetCallbackChannel <IDuplexCallBack>();

                lock (_sycnRoot)
                {
                    if (!_callbackChannels.Contains(callbackChannel))
                    {
                        _callbackChannels.Add(callbackChannel);
                        Console.WriteLine("Added Callback Channel: {0}", callbackChannel.GetHashCode());
                    }
                }
            }
            catch
            {
            }
        }