Beispiel #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);
            }
        }
Beispiel #2
0
        public ForgotPasswordViewModel(IIdentityService userService)
        {
            _userService = userService;
            _userName    = new ValidatableObject <string>();

            AddValidations();
        }
Beispiel #3
0
        public SignUpViewModel(IIdentityService userService)
        {
            _userService = userService;
            _userName    = new ValidatableObject <string>();
            _password    = new ValidatableObject <string>();

            AddValidations();
        }
Beispiel #4
0
        public AddViewModel(IMonitorService monitor)
        {
            _monitorService = monitor;
            _name           = new ValidatableObject <string>();
            _url            = new ValidatableObject <string>();

            addValidations();
        }
Beispiel #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);
            }
        }