Ejemplo n.º 1
0
        public async void Init()
        {
            await Task.Delay(100);

            this.mInAppPurchaseService.View = this;
            Mvx.Resolve <IMvxMessenger>().Publish(new ProgressMessage(this, true));

            //get list product ids from server
            var rs = await mApiService.GetProductIds(Mvx.Resolve <IPlatformService>().OS == OS.Touch? "apple" : "android");

            if (rs != null && rs.Response != null && rs.Response.Products != null && rs.Response.Products.Count > 0)
            {
                List <string> productIds = new List <string>();
                foreach (var item in rs.Response.Products)
                {
                    productIds.Add(item.ProductId);
                }

                var productsInfo = await mInAppPurchaseService.RequestProductsInformation(productIds);
            }
            else
            {
                Mvx.Resolve <IMvxMessenger>().Publish(new ToastMessage(this, rs.Response != null ? rs.Response.ErrorCode : "Error"));
            }

            Mvx.Resolve <IMvxMessenger>().Publish(new ProgressMessage(this, false));
        }