public AuthorizationViewModel(ChatProxy proxy) { _user = new UserDTO(); _proxy = proxy; _proxy.Connected += ProxyConnected; _proxy.Exception += ProxyException; AuthorizationCommand = new RelayCommand(Authorization); }
public void Disconnect(UserDTO user) { try { _chatClient.DisconnectAsync(user); } catch (Exception ex) { Exception(this, new ExceptionEventArgs { Message = ex.Message }); } }
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 }); } }
public IAsyncResult BeginReturnUser(UserDTO msg, AsyncCallback callback, object asyncState) { throw new NotImplementedException(); }
public void ReturnUser(UserDTO msg) { try { ReturnedUser(this, new ReturnUserEventArgs { User = msg }); } catch (Exception ex) { Exception(this, new ExceptionEventArgs { Message = ex.Message }); } }
public void GetLogByUser(UserDTO user) { try { _chatClient.GetLogByUserAsync(user); } catch (Exception ex) { Exception(this, new ExceptionEventArgs { Message = ex.Message }); } }
private void ProxyReturnedUser(object sender, ReturnUserEventArgs e) { _currentUser = e.User; }