Exemplo n.º 1
0
        async Task resetRequestAsync()
        {
            if (!Validate())
            {
                return;
            }

            User user = new User {
                UserName = _userName.Value,
            };

            try
            {
                await _userService.ResetAsync <User>(user);

                await DialogService.ShowAlertAsync(AppResources.ForgotPassword,
                                                   user.UserName,
                                                   AppResources.OK);

                Username = new ValidatableObject <string>();
                await NavigationService.PopAsync();
            }
            catch (ServiceAuthenticationException e)
            {
                await DialogService.ShowAlertAsync(AppResources.GenericError, AppResources.Error, AppResources.OK);
            }
            catch (HttpRequestExceptionEx e)
            {
                await DialogService.ShowAlertAsync(AppResources.GenericError, AppResources.Error, AppResources.OK);
            }
            catch (Exception e)
            {
                await DialogService.ShowAlertAsync(AppResources.GenericError, AppResources.Error, AppResources.OK);
            }
        }
Exemplo n.º 2
0
        public ForgotPasswordViewModel(IIdentityService userService)
        {
            _userService = userService;
            _userName    = new ValidatableObject <string>();

            AddValidations();
        }
Exemplo n.º 3
0
        public SignUpViewModel(IIdentityService userService)
        {
            _userService = userService;
            _userName    = new ValidatableObject <string>();
            _password    = new ValidatableObject <string>();

            AddValidations();
        }
Exemplo n.º 4
0
        public AddViewModel(IMonitorService monitor)
        {
            _monitorService = monitor;
            _name           = new ValidatableObject <string>();
            _url            = new ValidatableObject <string>();

            addValidations();
        }
Exemplo n.º 5
0
        async Task signUpRequestAsync()
        {
            if (!Validate())
            {
                return;
            }

            User user = new User {
                UserName = _userName.Value,
                Password = _password.Value
            };

            try
            {
                user = await _userService.SignUpAsync <User>(user);

                await DialogService.ShowAlertAsync(AppResources.SignUp, user.UserName, AppResources.OK);

                Username = new ValidatableObject <string>();
                Password = new ValidatableObject <string>();
                await NavigationService.NavigateToAsync <LoginViewModel>(user);
            }
            catch (ServiceAuthenticationException e)
            {
                await DialogService.ShowAlertAsync(AppResources.GenericError, AppResources.Error, AppResources.OK);
            }
            catch (HttpRequestExceptionEx e)
            {
                if (e.HttpCode == HttpStatusCode.Conflict)
                {
                    await DialogService.ShowAlertAsync(AppResources.DuplicateEmail, "", AppResources.OK);
                }
            }
            catch (Exception e)
            {
                await DialogService.ShowAlertAsync(AppResources.GenericError, AppResources.Error, AppResources.OK);
            }
        }