public void DisplayProduct(InAppPurchaseManager purchaseManager, InAppProduct product) { // Save copy of the current product and purchase manager _purchaseManager = purchaseManager; Product = product; // Set image based on the product type switch (product.ProductType) { case InAppProductType.NonConsumable: if (product.Downloadable) { ItemImage.Image = UIImage.FromFile("Images/Downloadable.png"); } else { ItemImage.Image = UIImage.FromFile("Images/NonConsumable.png"); } break; case InAppProductType.Consumable: ItemImage.Image = UIImage.FromFile("Images/Consumable.png"); break; case InAppProductType.AutoRenewableSubscription: ItemImage.Image = UIImage.FromFile("Images/Subscription.png"); break; case InAppProductType.FreeSubscription: ItemImage.Image = UIImage.FromFile("Images/FreeSubscription.png"); break; case InAppProductType.NonRenewingSubscription: ItemImage.Image = UIImage.FromFile("Images/NonRenewingSubscription.png"); break; case InAppProductType.Unknown: ItemImage.Image = UIImage.FromFile("Images/Unknown.png"); break; } // Fill in the rest of the information _isRestore = false; ItemTitle.Text = product.Title; DownloadProgress.Hidden = true; ItemDescription.Text = product.Description; ItemPrice.Text = product.FormattedPrice; BuyButton.SetTitle("Buy", UIControlState.Normal); BuyButton.Hidden = !_purchaseManager.CanMakePayments; BuyButton.Enabled = true; // Wireup Button WireupBuyButton(); }
/// <summary> /// Displays the restore previous purchases item /// </summary> /// <param name="purchaseManager">Purchase manager.</param> /// <param name="product">Product.</param> public void DisplayRestore(InAppPurchaseManager purchaseManager) { // Save copy of the current product and purchase manager _purchaseManager = purchaseManager; Product = null; // Fill in theg rest of the information _isRestore = true; ItemImage.Image = UIImage.FromFile("Images/RestorePurchases.png"); ItemTitle.Text = "Restore Purchases"; ItemDescription.Text = "Restore any previous purchases that you have made in this app."; DownloadProgress.Hidden = true; ItemPrice.Text = ""; BuyButton.SetTitle("Restore", UIControlState.Normal); BuyButton.Hidden = !_purchaseManager.CanMakePayments; BuyButton.Enabled = true; // Wireup Button WireupBuyButton(); }