private void LoginExecute() { long? userId = AuthorizationService.TryLogin(UserName, Password); if (userId.HasValue) { if (UserService.IsUserAlreadyLogged(userId.Value)) { MessageBox.Show("User already connected!"); return; } UserManager.Instance.UserId = userId.Value; UserService.LogInUser(UserManager.Instance.UserId); ChatWindow chatWindow = new ChatWindow(); currentWindow.Close(); chatWindow.ShowDialog(); } else { MessageBox.Show("Bad username or password!"); } }
private void SaveExecute() { UserManager.Instance.UserId = UserService.AddNewUser(newUser); UserService.LogInUser(UserManager.Instance.UserId); ChatWindow chatWindow = new ChatWindow(); currentWindow.Close(); chatWindow.ShowDialog(); }