Exemplo n.º 1
0
        private async void loadTestData(InAppPurchaseDesc desc, InAppPurchaseCreatedCallbackMethod createdCallback)
        {
            bool pass = true;

            try
            {
                MockIAPLib.MockIAP.Init();
                MockIAPLib.MockIAP.RunInMockMode(true);
                MockIAPLib.MockIAP.SetListingInformation(1, "en-us", "Some description", "1", "TestApp");

                int i = 1;
                foreach (var inApp in desc.WP8_MicrosoftStore_InAppIDs)
                {
                    var product = new MockIAPLib.ProductListing
                    {
                        Name           = inApp.ID,
                        ImageUri       = new Uri("/Res/ReignIcon.png", UriKind.Relative),
                        ProductId      = inApp.ID,
                        ProductType    = inApp.Type == InAppPurchaseTypes.NonConsumable ? ProductType.Durable : ProductType.Consumable,
                        Keywords       = new string[] { "image" },
                        Description    = "Product Desc " + i,
                        FormattedPrice = inApp.CurrencySymbol + inApp.Price,
                        Tag            = string.Empty
                    };

                    MockIAPLib.MockIAP.AddProductListing(inApp.ID, product);
                    ++i;
                }

                wp8TestListingInformation = await CurrentAppSimulator.LoadListingInformationAsync();

                MockIAPLib.MockIAP.ClearCache();
                wp8TestLicenseInformation = CurrentAppSimulator.LicenseInformation;
                wp8TestLicenseInformation.LicenseChanged += licenseChanged;
            }
            catch (Exception e)
            {
                Debug.LogError(e.Message);
                pass = false;
            }

            if (createdCallback != null)
            {
                createdCallback(pass);
            }
        }
		private async void loadTestData(InAppPurchaseDesc desc, InAppPurchaseCreatedCallbackMethod createdCallback)
		{
			bool pass = true;
			try
			{
				MockIAPLib.MockIAP.Init();
				MockIAPLib.MockIAP.RunInMockMode(true);
				MockIAPLib.MockIAP.SetListingInformation(1, "en-us", "Some description", "1", "TestApp");

				int i = 1;
				foreach (var inApp in desc.WP8_MicrosoftStore_InAppIDs)
				{
					var product = new MockIAPLib.ProductListing
					{
						Name = inApp.ID,
						ImageUri = new Uri("/Res/ReignIcon.png", UriKind.Relative),
						ProductId = inApp.ID,
						ProductType = inApp.Type == InAppPurchaseTypes.NonConsumable ? ProductType.Durable : ProductType.Consumable,
						Keywords = new string[] {"image"},
						Description = "Product Desc " + i,
						FormattedPrice = inApp.CurrencySymbol + inApp.Price,
						Tag = string.Empty
					};

					MockIAPLib.MockIAP.AddProductListing(inApp.ID, product);
					++i;
				}

				wp8TestListingInformation = await CurrentAppSimulator.LoadListingInformationAsync();
				MockIAPLib.MockIAP.ClearCache();
				wp8TestLicenseInformation = CurrentAppSimulator.LicenseInformation;
				wp8TestLicenseInformation.LicenseChanged += licenseChanged;
			}
			catch (Exception e)
			{
				Debug.LogError(e.Message);
				pass = false;
			}

			if (createdCallback != null) createdCallback(pass);
		}