Пример #1
0
 public AuthorizationViewModel(ChatProxy proxy)
 {
     _user = new UserDTO();
     _proxy = proxy;
     _proxy.Connected += ProxyConnected;
     _proxy.Exception += ProxyException;
     AuthorizationCommand = new RelayCommand(Authorization);
 }
Пример #2
0
 public void Disconnect(UserDTO user)
 {
     try
     {
         _chatClient.DisconnectAsync(user);
     }
     catch (Exception ex)
     {
         Exception(this, new ExceptionEventArgs { Message = ex.Message });
     }
 }
Пример #3
0
        public void Connect(string host, string port, UserDTO user)
        {
            try
            {
                CurrentUser = user;
                _chatClient = new ChatClient(new InstanceContext(this));

                var servicePath = _chatClient.Endpoint.ListenUri.AbsolutePath;
                _chatClient.Endpoint.Address = new EndpointAddress("net.tcp://" + host + ":" + port + servicePath);

                _chatClient.Open();

                RegisterServiceEvents();

                _chatClient.ConnectAsync(CurrentUser);
            }
            catch (Exception ex)
            {
                Exception(this, new ExceptionEventArgs { Message = ex.Message });
            }
        }
Пример #4
0
 public IAsyncResult BeginReturnUser(UserDTO msg, AsyncCallback callback, object asyncState)
 {
     throw new NotImplementedException();
 }
Пример #5
0
 public void ReturnUser(UserDTO msg)
 {
     try
     {
         ReturnedUser(this, new ReturnUserEventArgs { User = msg });
     }
     catch (Exception ex)
     {
         Exception(this, new ExceptionEventArgs { Message = ex.Message });
     }
 }
Пример #6
0
 public void GetLogByUser(UserDTO user)
 {
     try
     {
         _chatClient.GetLogByUserAsync(user);
     }
     catch (Exception ex)
     {
         Exception(this, new ExceptionEventArgs { Message = ex.Message });
     }
 }
Пример #7
0
 private void ProxyReturnedUser(object sender, ReturnUserEventArgs e)
 {
     _currentUser = e.User;
 }