コード例 #1
0
        private void launchConfirmationPage(MaskedWallet maskedWallet)
        {
            var intent = new Intent(this, typeof(ConfirmationActivity));

            intent.PutExtra(Constants.EXTRA_ITEM_ID, mItemId);
            intent.PutExtra(Constants.EXTRA_MASKED_WALLET, maskedWallet.JavaCast <IParcelable>());
            StartActivity(intent);
        }
        public override void OnActivityResult(int requestCode, int resultCode, Android.Content.Intent data)
        {
            mProgressDialog.Hide();

            // retrieve the error code, if available
            int errorCode = -1;

            if (data != null)
            {
                errorCode = data.GetIntExtra(WalletConstants.ExtraErrorCode, -1);
            }

            switch (requestCode)
            {
            case REQUEST_CODE_RESOLVE_ERR:
                if (resultCode == (int)Result.Ok)
                {
                    mGoogleApiClient.Connect();
                }
                else
                {
                    handleUnrecoverableGoogleWalletError(errorCode);
                }
                break;

            case REQUEST_CODE_RESOLVE_LOAD_FULL_WALLET:
                switch (resultCode)
                {
                case (int)Result.Ok:
                    if (data.HasExtra(WalletConstants.ExtraFullWallet))
                    {
                        FullWallet fullWallet =
                            data.GetParcelableExtra(WalletConstants.ExtraFullWallet).JavaCast <FullWallet> ();
                        // the full wallet can now be used to process the customer's payment
                        // send the wallet info up to server to process, and to get the result
                        // for sending a transaction status
                        fetchTransactionStatus(fullWallet);
                    }
                    else if (data.HasExtra(WalletConstants.ExtraMaskedWallet))
                    {
                        // re-launch the activity with new masked wallet information
                        mMaskedWallet = data.GetParcelableExtra(WalletConstants.ExtraMaskedWallet).JavaCast <MaskedWallet> ();
                        mActivityLaunchIntent.PutExtra(Constants.EXTRA_MASKED_WALLET, mMaskedWallet.JavaCast <IParcelable>());

                        StartActivity(mActivityLaunchIntent);
                    }
                    break;

                case (int)Result.Canceled:
                    // nothing to do here
                    break;

                default:
                    handleError(errorCode);
                    break;
                }
                break;
            }
        }