Пример #1
0
        private void InitStore()
        {
#if DEBUG
            MockIAPLib.MockIAP.Init();
            MockIAPLib.MockIAP.RunInMockMode(true);
            MockIAPLib.MockIAP.SetListingInformation(1, "en-us", "Some description", "1", "TestApp");

            // Add some more items manually.

            MockIAPLib.ProductListing p = new MockIAPLib.ProductListing
            {
                Name           = "FullStats",
                ImageUri       = new Uri("/Assets/StatsPickerPic.png", UriKind.Relative),
                ProductId      = "FullStats",
                ProductType    = Windows.ApplicationModel.Store.ProductType.Durable,
                Keywords       = new string[] { "Full Stats" },
                Description    = @"Full stats package includes: Player Minutes, Plus Minus,
                                Pass, Turnover, Offsides, 
                                Foul Committed, Out of Bounds, Cross, Throw In, Corner Kick, 
                                Tackle, Goalie Kick, Own Goal, Foul Drawn, Direct Free Kick,
                                Indirect Free Kick, Penalty Kick, Yellow Card, Red Card, Drop Kick,
                                Dribble, Shootout Kick, Substitution",
                FormattedPrice = "4.99",
                Tag            = string.Empty
            };

            MockIAPLib.MockIAP.AddProductListing("FullStats", p);
#endif
        }
Пример #2
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);
		}