public bool Register(string username, string password, IServerCommunication communication) { communication.GetMessage(); communication.SendMessage("2"); if (communication.GetMessage() != "ok") { communication.SendMessage("cancel"); communication.GetMessage(); communication.SendMessage("2"); communication.GetMessage(); } communication.SendMessage(username + " " + password); System.Threading.Thread.Sleep(500); string msg = communication.GetMessage(); if (msg == "ok") { _currentUser = new User(username, password); return(true); } else { // Error return(false); } }
public WelcomeViewModel( LoginViewModel loginVM, RegisterViewModel registerVM, IServerCommunication communication ) { _loginVM = loginVM; _registerVM = registerVM; _communication = communication; _communication.GetMessage(); }
public DashboardViewModel( TriangleViewModel triangleVM, ChangePasswordViewModel changePasswordVM, DeleteAccountViewModel deleteAccountVM, IEventAggregator aggregator, IServerCommunication communication ) { _triangleVM = triangleVM; _changePasswordVM = changePasswordVM; _deleteAccountVM = deleteAccountVM; _aggregator = aggregator; _communication = communication; }
public string TriangleType(string values, IServerCommunication communication) { string msg = communication.GetMessage(); communication.SendMessage("get_status"); if (communication.GetMessage() != "triangle") { communication.SendMessage("2"); } msg = communication.GetMessage(); communication.SendMessage(values); msg = communication.GetMessage(); return(msg); }
public bool ChangePassword(string password, IServerCommunication communication) { communication.SendMessage("1"); communication.GetMessage(); communication.SendMessage(_currentUser.Password + " " + password); System.Threading.Thread.Sleep(500); string msg = communication.GetMessage(); if (msg == "ok") { _currentUser.Password = password; return(true); } else { // Error return(false); } }
public DeleteAccountViewModel(IAuthenticator authenticator, IEventAggregator aggregator, IServerCommunication communication) { _authenticator = authenticator; _aggregator = aggregator; _communication = communication; }
public ChangePasswordViewModel(IAuthenticator authenticator, IServerCommunication communication) { _authenticator = authenticator; _communication = communication; }
public LoginViewModel(IAuthenticator authenticator, IEventAggregator aggregator, IServerCommunication communication) { _authenticator = authenticator; _aggregator = aggregator; _communication = communication; }
public LogoutEvent(IServerCommunication communication) { communication.SendMessage("4"); communication.GetMessage(); }
public TriangleViewModel(IServerCommunication communication, IMathOperation mathOperation) { _communication = communication; _mathOperation = mathOperation; }
public bool DeleteAccount(IServerCommunication communication) { communication.SendMessage("3"); communication.GetMessage(); return(true); }