示例#1
0
        private async void LoadTraps()
        {
            try
            {
                var response = await PurchaseApiService.ListAvailableTraps();

                if (response != null)
                {
                    availableTraps = response;

                    LoadGooglePrices();
                }
                else
                {
                    progressDialog.Cancel();

                    HomeActivity homeActivity = (HomeActivity)Activity;
                    homeActivity.OnSectionAttached(HomeActivity.HOME_MENU_INDEX, true);
                }

                if (!AppStatus.UserLogged.ContainsTraps())
                {
                    lbl_title_my_traps.Visibility = ViewStates.Gone;
                }
            }
            catch (Exception exception)
            {
                InsightsUtils.LogException(exception);
            }
        }
示例#2
0
        public async Task <BuyIntentApiRequest> InsertIntent(string productId)
        {
            BuyIntentApiRequest intent = new BuyIntentApiRequest()
            {
                StoreKey = productId
            };

            await PurchaseApiService.InsertBuyIntent(intent);

            return(intent);
        }
示例#3
0
        private async void LoadAvailableTraps()
        {
            var response = await PurchaseApiService.ListAvailableTraps();

            if (response != null)
            {
                availableTraps = response;

                LoadWindowsPrices();
            }
        }
示例#4
0
        public async Task <bool> RegisterPurchase(BuyIntentApiRequest intent)
        {
            bool result = false;

            try
            {
                result = await PurchaseApiService.RegisterPurchase(intent);
            }
            catch (Exception exception)
            {
                InsightsUtils.LogException(exception);
            }

            return(result);
        }
示例#5
0
        public async void TryBuy(AvailableTrapApiResult availableTrap)
        {
            progressDialog = ProgressDialog.Show(Activity, Resources.GetString(MyTrap.Droid.Resource.String.loading), Resources.GetString(MyTrap.Droid.Resource.String.registering_purchase));

            try
            {
                BuyIntentApiRequest intent = new BuyIntentApiRequest()
                {
                    AvailableTrapId = availableTrap.Id, StoreKey = availableTrap.KeyGoogle
                };

                await PurchaseApiService.InsertBuyIntent(intent);

                pendingBuyIntent = intent;

                Product product = null;

                foreach (var itemGoogle in products)
                {
                    if (itemGoogle.ProductId == availableTrap.KeyGoogle)
                    {
                        product = itemGoogle;
                        break;
                    }
                }

                if (product != null)
                {
                    //product.ProductId = "android.test.purchased";
                    //product.ProductId = "android.test.canceled";
                    //product.ProductId = "android.test.refunded";

                    //await RegisterPurchase(intent);

                    _serviceConnection.BillingHandler.BuyProduct(product);
                }
            }
            catch (Exception exception)
            {
                InsightsUtils.LogException(exception);
            }

            progressDialog.Cancel();
        }
示例#6
0
 public async void InvalidateBuyIntent(BuyIntentApiRequest intent)
 {
     await PurchaseApiService.InvalidateBuyIntent(intent);
 }