private async Task LoadInAppPurchaseProxyFileAsync() { StorageFolder proxyDataFolder = await Package.Current.InstalledLocation.GetFolderAsync("data"); StorageFile proxyFile = await proxyDataFolder.GetFileAsync("in-app-purchase.xml"); licenseChangeHandler = new LicenseChangedEventHandler(InAppPurchaseRefreshScenario); CurrentAppSimulator.LicenseInformation.LicenseChanged += licenseChangeHandler; await CurrentAppSimulator.ReloadSimulatorAsync(proxyFile); // setup application upsell message try { ListingInformation listing = await CurrentAppSimulator.LoadListingInformationAsync(); var product1 = listing.ProductListings["product1"]; var product2 = listing.ProductListings["product2"]; Product1SellMessage.Text = "You can buy " + product1.Name + " for: " + product1.FormattedPrice + "."; Product2SellMessage.Text = "You can buy " + product2.Name + " for: " + product2.FormattedPrice + "."; } catch (Exception) { rootPage.NotifyUser("LoadListingInformationAsync API call failed", NotifyType.ErrorMessage); } }
internal async void GetPrice() { try { #if DEBUG ListingInformation listing = await CurrentAppSimulator.LoadListingInformationAsync(); #else ListingInformation listing = await CurrentApp.LoadListingInformationAsync(); #endif List <string> ps = new List <string>(); foreach (var item in DonationPack) { var product = listing.ProductListings[item]; ps.Add(product.FormattedPrice); } Price = ps.ToArray(); licenseChangeHandler = new LicenseChangedEventHandler(licenseChangedEventHandler); #if DEBUG CurrentAppSimulator.LicenseInformation.LicenseChanged += licenseChangeHandler; #else CurrentApp.LicenseInformation.LicenseChanged += licenseChangeHandler; #endif } catch (Exception) { Price = null; } }
private async Task LoadAppListingUriProxyFileAsync() { StorageFolder proxyDataFolder = await Package.Current.InstalledLocation.GetFolderAsync("data"); StorageFile proxyFile = await proxyDataFolder.GetFileAsync("app-listing-uri.xml"); licenseChangeHandler = new LicenseChangedEventHandler(AppListingUriRefreshScenario); CurrentAppSimulator.LicenseInformation.LicenseChanged += licenseChangeHandler; await CurrentAppSimulator.ReloadSimulatorAsync(proxyFile); }
private async Task LoadExpiringProductProxyFileAsync() { StorageFolder proxyDataFolder = await Package.Current.InstalledLocation.GetFolderAsync("data"); StorageFile proxyFile = await proxyDataFolder.GetFileAsync("expiring-product.xml"); licenseChangeHandler = new LicenseChangedEventHandler(ExpiringProductRefreshScenario); CurrentAppSimulator.LicenseInformation.LicenseChanged += licenseChangeHandler; await CurrentAppSimulator.ReloadSimulatorAsync(proxyFile); }
public async void LicenseSimulator() { StorageFolder proxyDataFolder = await Package.Current.InstalledLocation.GetFolderAsync("Data"); StorageFile proxyFile = await proxyDataFolder.GetFileAsync("data.xml"); licenseChangeHandler = new LicenseChangedEventHandler(InAppPurchaseRefreshScenario); CurrentAppSimulator.LicenseInformation.LicenseChanged += licenseChangeHandler; await CurrentAppSimulator.ReloadSimulatorAsync(proxyFile); }
private async Task LoadReceiptProxyFileAsync() { StorageFolder proxyDataFolder = await Package.Current.InstalledLocation.GetFolderAsync("data"); StorageFile proxyFile = await proxyDataFolder.GetFileAsync("receipt.xml"); licenseChangeHandler = new LicenseChangedEventHandler(ReceiptRefreshScenario); CurrentAppSimulator.LicenseInformation.LicenseChanged += licenseChangeHandler; await CurrentAppSimulator.ReloadSimulatorAsync(proxyFile); }
/// <summary> /// Set your own Uri file to locate the new Uri("ms-appx:///Data/Data.data.xml) file. Put it on "if DEBUG Region". /// </summary> #if DEBUG public static async void LicenseSimulatorCustom(Uri uri) { try { var proxyFile = await Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(uri); licenseChangeHandler = new LicenseChangedEventHandler(InAppPurchaseRefreshScenario); CurrentAppSimulator.LicenseInformation.LicenseChanged += licenseChangeHandler; await CurrentAppSimulator.ReloadSimulatorAsync(proxyFile); } catch { } }
private async Task LoadTrialModeProxyFileAsync() { StorageFolder proxyDataFolder = await Package.Current.InstalledLocation.GetFolderAsync("data"); StorageFile proxyFile = await proxyDataFolder.GetFileAsync("trial-mode.xml"); licenseChangeHandler = new LicenseChangedEventHandler(TrialModeRefreshScenario); CurrentAppSimulator.LicenseInformation.LicenseChanged += licenseChangeHandler; await CurrentAppSimulator.ReloadSimulatorAsync(proxyFile); // setup application upsell message ListingInformation listing = await CurrentAppSimulator.LoadListingInformationAsync(); PurchasePrice.Text = "You can buy the full app for: " + listing.FormattedPrice + "."; }
private async void LoadInAppPurchaseProxyFileAsync() { //StorageFolder proxyDataFolder = await Package.Current.InstalledLocation.GetFolderAsync("data"); //StorageFile proxyFile = await proxyDataFolder.GetFileAsync("in-app-product.xml"); //await IAPs.ReloadSimulatorAsync(proxyFile); licenseChangeHandler = new LicenseChangedEventHandler(InAppPurchaseRefreshScenario); IAPs.LicenseInformation.LicenseChanged += licenseChangeHandler; try { ListingInformation listing = await IAPs.LoadListingInformationAsync(); if (!listing.ProductListings.ContainsKey("CCPLAYER_IAP_REMOVE_ADVERTISING") || !listing.ProductListings.ContainsKey("CCPLAYER_IAP_UNLOCK_FEATURES")) { CmdBar.Visibility = Visibility.Collapsed; return; } ChangeCommandBarState(); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); CmdBar.Visibility = Visibility.Collapsed; } finally { if (CmdBar.Visibility == Visibility.Collapsed) { IAPs.LicenseInformation.LicenseChanged -= licenseChangeHandler; Messenger.Default.Send(true, typeof(AdMainPage).FullName); } else { Messenger.Default.Register <bool>(this, typeof(MainPage).FullName, (val) => { if (!VersionHelper.IsFullVersion) { CmdBar.Visibility = !val ? Visibility.Visible : Visibility.Collapsed; } }); } } }
private async Task LoadTrialModeProxyFileAsync() { StorageFolder proxyDataFolder = await Package.Current.InstalledLocation.GetFolderAsync("data"); StorageFile proxyFile = await proxyDataFolder.GetFileAsync("trial-mode.xml"); licenseChangeHandler = new LicenseChangedEventHandler(TrialModeRefreshScenario); CurrentAppSimulator.LicenseInformation.LicenseChanged += licenseChangeHandler; await CurrentAppSimulator.ReloadSimulatorAsync(proxyFile); // setup application upsell message try { ListingInformation listing = await CurrentAppSimulator.LoadListingInformationAsync(); PurchasePrice.Text = "You can buy the full app for: " + listing.FormattedPrice + "."; } catch (Exception) { rootPage.NotifyUser("LoadListingInformationAsync API call failed", NotifyType.ErrorMessage); } }
private async Task LoadInAppPurchaseProxyFileAsync() { StorageFolder proxyDataFolder = await Package.Current.InstalledLocation.GetFolderAsync("Assets"); StorageFile proxyFile = await proxyDataFolder.GetFileAsync("in-app-purchase.xml"); licenseChangeHandler = new LicenseChangedEventHandler(InAppPurchaseRefreshScenario); CurrentAppSimulator.LicenseInformation.LicenseChanged += licenseChangeHandler; await CurrentAppSimulator.ReloadSimulatorAsync(proxyFile); try { listing = await CurrentAppSimulator.LoadListingInformationAsync(); } catch (Exception) { var messageDialog = new MessageDialog("LoadListingInformationAsync API gagal"); var task = messageDialog.ShowAsync().AsTask(); } }
public static void EnableDebugWindowsStoreProxy(LicenseChangedHandler licenseChangedHandler, string windowsStoreProxy) { #if NETFX_CORE if (licenseChangedHandler != null) { LicenseChangedEventHandler licenseChangedEventHandler = new LicenseChangedEventHandler(licenseChangedHandler); CurrentAppSimulator.LicenseInformation.LicenseChanged += licenseChangedEventHandler; } WriteWindowsStoreProxyFileAsync(windowsStoreProxy); #endif }