public async void SendResetPasswordLink() { if (String.IsNullOrEmpty(EmailAddress)) { await Popups.ShowAsync(ClientResources.Register_Email_Required); return; } var emailRegEx = new Regex(EMAIL_REGEX); if (!emailRegEx.Match(EmailAddress).Success) { await Popups.ShowAsync(ClientResources.Register_Email_Invalid); return; } if ((await PerformNetworkOperation(CallSendInvite)).Successful) { await Popups.ShowAsync(ClientResources.SendResetPasswordLink_Message); await ViewModelNavigation.GoBackAsync(); } }
public override async void Save() { if (!FormAdapter.IsDirty && !HasDirtyChildren && LaunchArgs.LaunchType == LaunchTypes.Edit) { await ViewModelNavigation.GoBackAsync(); } else if (FormAdapter.Validate()) { ViewToModel(FormAdapter, Model); if (Model is IValidateable) { var result = Validator.Validate(Model as IValidateable); if (!result.Successful) { await ShowValidationErrorsAsync(result); return; } } var saveResult = await SaveRecordAsync(); if (saveResult.Successful) { //See notes on this method we allow the view model to override what happens when the record is saved. HasDirtyChildren = false; NotifyParentChildDirty(); await PostSaveAsync(); } } }
public async void InviteUser() { if ((await PerformNetworkOperation(SendUserInvitation)).Successful) { await Popups.ShowAsync(ClientResources.InviteUser_InvitationSent); await ViewModelNavigation.GoBackAsync(); } }
public ResetPasswordViewModel(IRestClient rawRestClient) { _rawRestClient = rawRestClient; Model = new ResetPassword(); ResetPasswordCommand = new RelayCommand(ResetPassword); CancelCommand = new RelayCommand(() => ViewModelNavigation.GoBackAsync()); }
public async void AcceptInvite() { if ((await PerformNetworkOperation(SendAcceptInvite)).Successful) { await Popups.ShowAsync(ClientResources.Accept_AcceptLoggedInSuccessful); await ViewModelNavigation.GoBackAsync(); } }
public RegisterUserViewModel(IAppConfig appConfig, IDeviceInfo deviceInfo, IClientAppInfo clientAppInfo) { RegisterModel = new RegisterUser(); RegisterModel.AppId = appConfig.AppName; RegisterModel.DeviceId = deviceInfo.DeviceUniqueId; RegisterModel.ClientType = "mobileapp"; RegisterCommand = new RelayCommand(Register); CancelCommand = new RelayCommand(() => ViewModelNavigation.GoBackAsync()); }
protected async override void ItemSelected(OrgUser model) { SelectedItem = null; if (model.OrgId == AuthManager.User.CurrentOrganization.Id) { return; } var result = await PerformNetworkOperation(async() => { var authRequest = new AuthRequest() { AppId = _appConfig.AppId, ClientType = "mobileapp", DeviceId = _deviceInfo.DeviceUniqueId, AppInstanceId = AuthManager.AppInstanceId, GrantType = "refreshtoken", UserName = AuthManager.User.Email, Email = AuthManager.User.Email, RefreshToken = AuthManager.RefreshToken, OrgId = model.OrgId, OrgName = model.OrganizationName }; var response = await RestClient.PostAsync <AuthRequest, AuthResponse>("/api/org/change", authRequest); if (!response.Successful) { return(response.ToInvokeResult()); } AuthManager.Roles = response.Result.Roles; var refreshResult = await RefreshUserFromServerAsync(); if (refreshResult.Successful) { await Popups.ShowAsync($"{ClientResources.UserOrgs_WelcometoNew} {AuthManager.User.CurrentOrganization.Text}"); } return(refreshResult.ToInvokeResult()); }); if (result.Successful) { await ViewModelNavigation.GoBackAsync(); } }
public async void ResetPassword() { if (String.IsNullOrEmpty(Model.Email)) { await Popups.ShowAsync(ClientResources.Register_Email_Required); return; } var emailRegEx = new Regex(EMAIL_REGEX); if (!emailRegEx.Match(Model.Email).Success) { await Popups.ShowAsync(ClientResources.Register_Email_Invalid); return; } var passwordRegEx = new Regex(PASSWORD_REGEX); if (!passwordRegEx.Match(Model.NewPassword).Success) { await Popups.ShowAsync(ClientResources.Password_Requirements); return; } if (Model.NewPassword != ConfirmPassword) { await Popups.ShowAsync(ClientResources.Register_Password_Confirm_NoMatch); return; } Model.Token = LaunchArgs.Parameters["code"].ToString(); if ((await PerformNetworkOperation(SendResetPasswordAsync)).Successful) { await Popups.ShowAsync(ClientResources.ResetPassword_SuccessMessage); await ViewModelNavigation.GoBackAsync(); } }
public async void ChangePassword() { Model.UserId = AuthManager.User.Id; var validationResult = Model.Validate(ConfirmPassword); if (validationResult.Successful) { if ((await PerformNetworkOperation(SendResetPassword)).Successful) { await Popups.ShowAsync(ClientResources.ChangePassword_Success); await ViewModelNavigation.GoBackAsync(); } } else { await ShowServerErrorMessageAsync(validationResult); } }
public ChangePasswordViewModel(IRestClient rawRestClient) { ChangePasswordCommand = new RelayCommand(ChangePassword); CancelCommand = new RelayCommand(() => ViewModelNavigation.GoBackAsync()); Model = new UserAdmin.Models.DTOs.ChangePassword(); }
public InviteUserViewModel(IRestClient rawRestClient) { InviteUserCommand = new RelayCommand(InviteUser); CancelCommand = new RelayCommand(() => ViewModelNavigation.GoBackAsync()); Model = new UserAdmin.Models.DTOs.InviteUser(); }
public SendResetPasswordLinkViewModel() { SendResetPasswordLinkCommand = new RelayCommand(SendResetPasswordLink); CancelCommand = new RelayCommand(() => ViewModelNavigation.GoBackAsync()); }
/* By default when the view model is saved we simply close the page, the view model can overide this to provide different behavior*/ public virtual Task PostSaveAsync() { return(ViewModelNavigation.GoBackAsync()); }
public async void CloseScreen() { await ViewModelNavigation.GoBackAsync(); }
public async Task CloseScreenAsync() { await ViewModelNavigation.GoBackAsync(); }
protected async override void ItemSelected(DeviceTypeSummary model) { LaunchArgs.SelectedAction(model); await ViewModelNavigation.GoBackAsync(); }