コード例 #1
0
ファイル: CredentialManager.cs プロジェクト: YoloDev/NabbR
        public async Task <CredentialResult> GetCredentials(String resource)
        {
            CredentialResult credentials = this.GetStoredCredentials(resource);

            if (credentials == null)
            {
                credentials = await PromptForCredentials(resource);
            }

            return(credentials);
        }
コード例 #2
0
ファイル: CredentialManager.cs プロジェクト: YoloDev/NabbR
        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);
        }
コード例 #3
0
ファイル: CredentialManager.cs プロジェクト: YoloDev/NabbR
        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);
        }