public async Task<User> CreateUser(string username, string pass, string email) { try { var user = new ParseUser() { Username = username, Password = pass, Email = email }; User createdUser = new User() { Username = user.Username }; await user.SignUpAsync(); await ParseUser.LogInAsync(username, pass); ((App)App.Current).AuthenticatedUser = ParseUser.CurrentUser; return createdUser; } catch (Exception e) { new MessageDialog(e.Message).ShowAsync(); return null; } }
public async Task<User> Login(string username, string pass) { try { await ParseUser.LogInAsync(username, pass); var currentUser = ParseUser.CurrentUser; User createdUser = new User() { Username = currentUser.Username }; ((App)App.Current).AuthenticatedUser = currentUser; return createdUser; } catch (Exception e) { new MessageDialog("Грешно потребителско име или парола.").ShowAsync(); return null; } }