Example #1
0
        private ChatService()
        {
            _messages = Observable.Create <ChatMessage>(observer =>
            {
                try
                {
                    if (_client == null)
                    {
                        _clientCallback = new ChatServiceClientCallback(observer);
                        _client         = new ChatServiceClient(new InstanceContext(_clientCallback));
                        _client.ChannelFactory.Closed  += (s, a) => { observer.OnCompleted(); };
                        _client.ChannelFactory.Faulted += (s, a) => { observer.OnCompleted(); };

                        if (_login != null)
                        {
                            _token = _client.Connect(_login);
                        }
                    }
                }
                catch (Exception e)
                {
                    observer.OnError(e);
                }

                return(() =>
                {
                    _client.Close();
                    _client = null;
                });
            });
        }
Example #2
0
 private ChatServiceClient(ChatServiceClientCallback callbackImpl) :
     base(new System.ServiceModel.InstanceContext(callbackImpl))
 {
     callbackImpl.Initialize(this);
 }
Example #3
0
 private ChatServiceClient(ChatServiceClientCallback callbackImpl, System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
     base(new System.ServiceModel.InstanceContext(callbackImpl), binding, remoteAddress)
 {
     callbackImpl.Initialize(this);
 }
Example #4
0
 private ChatServiceClient(ChatServiceClientCallback callbackImpl, EndpointConfiguration endpointConfiguration) :
     base(new System.ServiceModel.InstanceContext(callbackImpl), endpointConfiguration)
 {
     callbackImpl.Initialize(this);
 }
 private ChatServiceClient(ChatServiceClientCallback callbackImpl) :
     this(new System.ServiceModel.InstanceContext(callbackImpl))
 {
     useGeneratedCallback = true;
     callbackImpl.Initialize(this);
 }
 private ChatServiceClient(ChatServiceClientCallback callbackImpl, string endpointConfigurationName) :
     this(new System.ServiceModel.InstanceContext(callbackImpl), endpointConfigurationName)
 {
     useGeneratedCallback = true;
     callbackImpl.Initialize(this);
 }