示例#1
0
        private void GotSecurityTokenResponse(object sender, RequestSecurityTokenResponseEventArgs e)
        {
            if (e.Error == null)
            {
                var data = new Intent();
                data.PutExtra("monodroid.watoolkit.library.login.RequestSecurityTokenResponse", e.Response);

                if (Parent == null)
                {
                    SetResult(Result.Ok, data);
                }
                else
                {
                    Parent.SetResult(Result.Ok, data);
                }
            }
            else
            {
                if (Parent == null)
                {
                    SetResult(Result.Canceled);
                }
                else
                {
                    Parent.SetResult(Result.Canceled);
                }
            }
            Finish();
        }
        private async void GotSecurityTokenResponse(object sender, RequestSecurityTokenResponseEventArgs e)
        {
            _notify.GotSecurityTokenResponse -= GotSecurityTokenResponse;
            if (e.Error == null)
            {
                var token = await RequestSecurityTokenResponse.FromJSONAsync(e.Response);

                _messageHub.Publish(new RequestTokenMessage(this)
                {
                    TokenResponse = token
                });

                if (Parent == null)
                {
                    SetResult(Result.Ok);
                }
                else
                {
                    Parent.SetResult(Result.Ok);
                }
            }
            else
            {
                _messageHub.Publish(new RequestTokenMessage(this)
                {
                    TokenResponse = null
                });

                if (Parent == null)
                {
                    SetResult(Result.Canceled);
                }
                else
                {
                    Parent.SetResult(Result.Canceled);
                }
            }
            Finish();
        }
        private async void GotSecurityTokenResponse(object sender, RequestSecurityTokenResponseEventArgs e)
        {
            if (e.Error == null)
            {
                var token = await RequestSecurityTokenResponse.FromJSONAsync(e.Response);
                _messageHub.Publish(new RequestTokenMessage(this) {TokenResponse = token});

                if (Parent == null)
                    SetResult(Result.Ok);
                else
                    Parent.SetResult(Result.Ok);
            }
            else
            {
                _messageHub.Publish(new RequestTokenMessage(this) { TokenResponse = null });

                if (Parent == null)
                    SetResult(Result.Canceled);
                else
                    Parent.SetResult(Result.Canceled);
            }
            Finish();
        }