Example #1
0
        private async void RegisterUserAsync()
        {
            try
            {
                IsBusy = true;

                CreateUserService req = await CreateUserService.CreateUserAsync(Email, Password);

                if (!req.IsSuccessful)
                {
                    IsBusy = false;
                    ErrorHelper.ControlError(req.Errors, false);
                    return;
                }
                else
                {
                    UserService.SaveUser(req.User, req.Token);
                    App.Current.MainPage = new MainPage();
                    IsBusy = false;
                }
            }
            catch (Exception ex)
            {
                IsBusy = false;
                ErrorHelper.ControlError(ex, false);
            }
        }
Example #2
0
        private async void CreateUser()
        {
            try
            {
                var result = await CreateUserService.CreateUserAsync(
                    Username,
                    Password,
                    ConfirmPassword);

                if (result == null)
                {
                    throw new CreateUserException("An error occured creating your user. Please try again");
                }

                SaveUserSecurityService.SaveUser(result);

                await Navigation.PushModalAsync(new ScorePredictNavigationPage(new MainPage()));

                await Navigation.PopToRootAsync(false);
            }
            catch (CreateUserException ex)
            {
                DialogService.Alert(ex.Message);
            }
            catch
            {
                DialogService.Alert("An unknown error occurred. Please try again");
            }
        }