/// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.  The Parameter
        /// property is typically used to configure the page.</param>
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            await MainPage.ConfigureSimulatorAsync("in-app-purchase-consumables-advanced.xml");

            try
            {
                ListingInformation listing = await CurrentAppSimulator.LoadListingInformationAsync();

                // Initialize the UI for our consumables.
                foreach (ProductPurchaseInfo info in purchaseInfos)
                {
                    var product = listing.ProductListings[info.productId];
                    info.nameRun.Text  = product.Name;
                    info.priceRun.Text = product.FormattedPrice;
                }

                rootPage.NotifyUser("", NotifyType.StatusMessage);
            }
            catch (Exception)
            {
                rootPage.NotifyUser("LoadListingInformationAsync API call failed", NotifyType.ErrorMessage);
            }

            // recover any unfulfilled consumables
            try
            {
                IReadOnlyList <UnfulfilledConsumable> consumables = await CurrentAppSimulator.GetUnfulfilledConsumablesAsync();

                foreach (UnfulfilledConsumable consumable in consumables)
                {
                    foreach (ProductPurchaseInfo info in purchaseInfos)
                    {
                        if (info.productId == consumable.ProductId)
                        {
                            // This is a consumable which the user purchased but which has not yet been fulfilled.
                            // Update our statistics so we know that there is a purchase pending.
                            info.numPurchases++;

                            // This is where you would normally grant the user their consumable content and call currentApp.reportConsumableFulfillment.
                            // For demonstration purposes, we leave the purchase unfulfilled.
                            info.tempTransactionId = consumable.TransactionId;
                        }
                    }
                }
            }
            catch (Exception)
            {
                rootPage.NotifyUser("GetUnfulfilledConsumablesAsync API call failed", NotifyType.ErrorMessage);
            }
            UpdateStatistics();
        }
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.  The Parameter
        /// property is typically used to configure the page.</param>
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            CurrentAppSimulator.LicenseInformation.LicenseChanged += OnLicenseInformationChanged;
            await MainPage.ConfigureSimulatorAsync("trial-mode.xml");

            try
            {
                ListingInformation listing = await CurrentAppSimulator.LoadListingInformationAsync();

                PurchasePrice.Text = listing.FormattedPrice;
            }
            catch (Exception)
            {
                rootPage.NotifyUser("LoadListingInformationAsync API call failed", NotifyType.ErrorMessage);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.  The Parameter
        /// property is typically used to configure the page.</param>
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            await MainPage.ConfigureSimulatorAsync("in-app-purchase-consumables.xml");

            try
            {
                ListingInformation listing = await CurrentAppSimulator.LoadListingInformationAsync();

                var product1 = listing.ProductListings["product1"];
                Product1Name.Text  = product1.Name;
                Product1Price.Text = product1.FormattedPrice;
                rootPage.NotifyUser("", NotifyType.StatusMessage);
            }
            catch (Exception)
            {
                rootPage.NotifyUser("LoadListingInformationAsync API call failed", NotifyType.ErrorMessage);
            }
        }
Esempio n. 4
0
 /// <summary>
 /// Invoked when this page is about to be displayed in a Frame.
 /// </summary>
 /// <param name="e">Event data that describes how this page was reached.  The Parameter
 /// property is typically used to configure the page.</param>
 protected override async void OnNavigatedTo(NavigationEventArgs e)
 {
     CurrentAppSimulator.LicenseInformation.LicenseChanged += ExpiringProductRefreshScenario;
     await MainPage.ConfigureSimulatorAsync("expiring-product.xml");
 }
 /// <summary>
 /// Invoked when this page is about to be displayed in a Frame.
 /// </summary>
 /// <param name="e">Event data that describes how this page was reached.  The Parameter
 /// property is typically used to configure the page.</param>
 protected override async void OnNavigatedTo(NavigationEventArgs e)
 {
     await MainPage.ConfigureSimulatorAsync("receipt.xml");
 }
Esempio n. 6
0
 /// <summary>
 /// Invoked when this page is about to be displayed in a Frame.
 /// </summary>
 /// <param name="e">Event data that describes how this page was reached.  The Parameter
 /// property is typically used to configure the page.</param>
 protected override async void OnNavigatedTo(NavigationEventArgs e)
 {
     await MainPage.ConfigureSimulatorAsync("app-listing-uri.xml");
 }