Пример #1
0
        private void PollForCompletionStatusAsync()
        {
            if (IsCancelled)
            {
                return;
            }

            task = client.GetCompletionStatusOfCheckout(Checkout, async(status, error) => {
                if (status == Status.Processing)
                {
                    await Task.Delay(500);
                    PollForCompletionStatusAsync();
                }
                else
                {
                    CompletionStatus = status;

                    WillChangeValue("isFinished");
                    done = true;
                    DidChangeValue("isFinished");

                    if (error != null)
                    {
                        FailedToReceiveCompletionStatus?.Invoke(this, error);
                    }
                    else
                    {
                        DidReceiveCompletionStatus?.Invoke(this, status);
                    }
                }
            });
        }
Пример #2
0
        private void GetCompletionStatusAndCompletedCheckoutWithURL(NSUrl url)
        {
            UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;

            client.GetCompletionStatusOfCheckout(url, (status, error) => {
                UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;

                if (error == null && status == Status.Complete)
                {
                    Console.WriteLine("Successfully completed checkout");
                    GetCompletedCheckout(() => {
                        InvokeOnMainThread(() => {
                            ShowCheckoutConfirmation();
                        });
                    });
                }
                else
                {
                    Console.WriteLine("Error completing checkout: {0}", error);
                }
            });
        }