public async Task <CredentialResult> GetCredentials(String resource) { CredentialResult credentials = this.GetStoredCredentials(resource); if (credentials == null) { credentials = await PromptForCredentials(resource); } return(credentials); }
public Task <CredentialResult> GetCredentials(String resource) { TaskCompletionSource <CredentialResult> source = new TaskCompletionSource <CredentialResult>(); this.dialogService.Show <LoginViewModel>("/login", (vm, result) => { CredentialResult credential = null; if (result) { credential = new CredentialResult(vm.Username, vm.Password); } source.SetResult(credential); }); return(source.Task); }
private async Task <CredentialResult> PromptForCredentials(String resource) { CredentialResult credential = null; CredentialPickerOptions options = new CredentialPickerOptions { Message = "Your credentials will be used to connect to JabbR.", Caption = "Please enter your JabbR username and password.", CredentialSaveOption = CredentialSaveOption.Unselected, AuthenticationProtocol = 0, TargetName = resource, }; var result = await CredentialPicker.PickAsync(options); if (result.ErrorCode == 0) { credential = new CredentialResult(result.CredentialUserName, result.CredentialPassword); } return(credential); }