コード例 #1
0
        /// <summary>
        /// Add a MEGA product as test product to the Mock Iap library
        /// </summary>
        /// <param name="product">MEGA product to add to Mock Iap</param>
        public static void AddProductToMockIap(Product product)
        {
            if (product == null)
            {
                return;
            }

            string productId = product.MicrosoftStoreId;

            // Only add the products once
            if (!MockIAP.allProducts.ContainsKey(productId))
            {
                var p = new ProductListing
                {
                    Name           = product.Name + " (" + product.Months + " months)",
                    ProductId      = productId,
                    ImageUri       = null,
                    ProductType    = Windows.ApplicationModel.Store.ProductType.Durable,
                    Keywords       = new[] { productId },
                    Description    = product.Name,
                    FormattedPrice = product.FormattedPrice,
                    Tag            = string.Empty
                };

                MockIAP.AddProductListing(productId, p);
            }
        }
コード例 #2
0
        private void SetupMockIAP()
        {
            MockIAP.Init();

            MockIAP.RunInMockMode(true);
            MockIAP.SetListingInformation(1, "en-us", "2D Platformer", "$0.00", "2D Platformer");

            var mockupLicenseInfo = App.GetResourceStream(new Uri("Assets\\Xmls\\MockupLicenseInfo.xml", UriKind.Relative));

            System.Xml.Linq.XDocument doc = System.Xml.Linq.XDocument.Load(mockupLicenseInfo.Stream);
            string xml = doc.ToString();

            MockIAP.PopulateIAPItemsFromXml(xml);

            GetListingInfo();

            // Add some more items manually.
            //ProductListing p = new ProductListing
            //{
            //    Name = "img.2",
            //    ImageUri = new Uri("/Res/Image/2.jpg", UriKind.Relative),
            //    ProductId = "img.2",
            //    ProductType = Windows.ApplicationModel.Store.ProductType.Durable,
            //    Keywords = new string[] { "image" },
            //    Description = "An image",
            //    FormattedPrice = "1.0",
            //    Tag = string.Empty
            //};
            //MockIAP.AddProductListing("img.2", p);
        }
コード例 #3
0
ファイル: App.xaml.cs プロジェクト: lhanneman/windows-phone
        private void SetupMockIAP()
        {
#if DEBUG
            MockIAP.Init();
            MockIAP.RunInMockMode(true);
            MockIAP.SetListingInformation(1, "en-us", "Remove Ads", "1", "MemorySquared");

            // ADD ONE ITEM TO PURCHASE WHICH WILL BE THE VERSION
            // OF THE GAME WITHOUT ADS:

            ProductListing p = new ProductListing
            {
                Name = "RemoveAds",
                //ImageUri = new Uri("/Res/Image/1.png", UriKind.Relative),
                ProductId      = "RemoveAds",
                ProductType    = Windows.ApplicationModel.Store.ProductType.Durable,
                Keywords       = new string[] { "Remove", "Ads" },
                Description    = "This will remove ads from the app",
                FormattedPrice = "1.0",
                Tag            = string.Empty
            };

            MockIAP.AddProductListing("RemoveAds", p);
#endif
        }
コード例 #4
0
        /// <summary>
        /// Setup the Mocking Library for in app purchases
        /// </summary>
        public static void SetupMockIap()
        {
            MockIAP.Init();
            MockIAP.ClearCache();
            MockIAP.RunInMockMode(true);

            // Default listing information to test iap
            // Use the current culture to retrieve products for the current mobile phone
            MockIAP.SetListingInformation(1, CultureInfo.CurrentUICulture.Name, "Test description", "1", "TestApp");

            // Needed 1 product to check products in license service is available
            var p = new ProductListing
            {
                Name           = "Test",
                ProductId      = "Test",
                ImageUri       = null,
                ProductType    = Windows.ApplicationModel.Store.ProductType.Durable,
                Keywords       = new[] { "Test" },
                Description    = "Test",
                FormattedPrice = "0.99",
                Tag            = string.Empty
            };

            MockIAP.AddProductListing("Test", p);
        }
コード例 #5
0
ファイル: Store.cs プロジェクト: Megapop/EtceteraWindows
        public static void LoadTest(uint ageRating, string currentMarket, string description, string formattedPrice, string name, Dictionary <string, ProductListing> products)
        {
#if DEBUG
            MockIAP.Init();

            MockIAP.RunInMockMode(true);
            MockIAP.SetListingInformation(ageRating, currentMarket, description, formattedPrice, name);

            foreach (var productListing in products)
            {
                var key     = productListing.Key;
                var product = productListing.Value;
                // Add some more items manually.
                var p = new MockIAPLib.ProductListing
                {
                    Name           = product.Name,
                    ProductId      = product.ProductId,
                    ProductType    = (Windows.ApplicationModel.Store.ProductType)product.ProductType,
                    Description    = product.Description,
                    FormattedPrice = product.FormattedPrice,
                    Tag            = string.Empty
                };
                MockIAP.AddProductListing(key, p);
            }
#endif
        }
コード例 #6
0
ファイル: Store.cs プロジェクト: Megapop/EtceteraWindows
        public static void LoadTest(uint ageRating, string currentMarket, string description, string formattedPrice, string name, string xml)
        {
#if DEBUG
            MockIAP.Init();

            MockIAP.RunInMockMode(true);
            MockIAP.SetListingInformation(ageRating, currentMarket, description, formattedPrice, name);

            MockIAP.PopulateIAPItemsFromXml(xml);
#endif
        }
コード例 #7
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
#if DEBUG
            if (MessageBoxResult.OK == MessageBox.Show("This will clear your store state, sure?", "Clear State", MessageBoxButton.OKCancel))
            {
                MockIAP.ClearCache();

                MessageBox.Show("State cleared! Restart app please");
            }
#endif
        }
コード例 #8
0
ファイル: StoreManager.cs プロジェクト: yanivnizan/wp-store
        /// <summary>   Setup the Windows Store test mode by loading the IAPMock.xml file at the root path. </summary>
        private void SetupMockIAP()
        {
            MockIAP.Init();

            MockIAP.RunInMockMode(true);
            MockIAP.SetListingInformation(1, "en-us", "A description", "0", "TestApp");
            var xDocument = XDocument.Load("IAPMock.xml");

            SoomlaUtils.LogDebug(TAG, "WStorePlugin Mock XML " + xDocument.ToString());

            MockIAP.PopulateIAPItemsFromXml(xDocument.ToString());
        }
コード例 #9
0
        private void SetupMockIAP()
        {
#if DEBUG
            MockIAP.Init();
            MockIAP.RunInMockMode(true);
            MockIAP.SetListingInformation(1, "nl-nl", "desc", "1", "Treintijden");

            ProductListing p = new ProductListing()
            {
                Description    = "1",
                FormattedPrice = "9.0",
                ImageUri       = new Uri("/Images/Purchase/upgrade1.png", UriKind.Relative),
                Name           = "Passagier",
                ProductId      = "upgrade1",
                ProductType    = Windows.ApplicationModel.Store.ProductType.Durable,
                Keywords       = new string[] { "" },
                Tag            = string.Empty
            };
            ProductListing p2 = new ProductListing()
            {
                Description    = "1",
                FormattedPrice = "2.0",
                ImageUri       = new Uri("/Images/Purchase/upgrade2.png", UriKind.Relative),
                Name           = "Conducteur",
                ProductId      = "upgrade2",
                ProductType    = Windows.ApplicationModel.Store.ProductType.Durable,
                Keywords       = new string[] { "" },
                Tag            = string.Empty
            };

            ProductListing p3 = new ProductListing()
            {
                Description    = "1",
                FormattedPrice = "5.0",
                ImageUri       = new Uri("/Images/Purchase/upgrade3.png", UriKind.Relative),
                Name           = "Machinist",
                ProductId      = "upgrade3",
                ProductType    = Windows.ApplicationModel.Store.ProductType.Durable,
                Keywords       = new string[] { "" },
                Tag            = string.Empty
            };



            MockIAP.AddProductListing("upgrade1", p);
            MockIAP.AddProductListing("upgrade2", p2);
            MockIAP.AddProductListing("upgrade3", p3);
#endif
        }
コード例 #10
0
        private void SetupInAppMock()
        {
            MockIAP.Init();

            MockIAP.RunInMockMode(true);

            MockIAP.SetListingInformation(1, "de-DE", "Verändere Bilder mit Filter", "1,99 €", "Image Filters");
            var streamInfo = GetResourceStream(new Uri("Assets/InAppMockProducts.xml", UriKind.Relative));

            using (var reader = new StreamReader(streamInfo.Stream))
            {
                string xml = reader.ReadToEnd();
                MockIAP.PopulateIAPItemsFromXml(xml);
            }
        }
コード例 #11
0
        /// <summary>
        /// Constructor for the Application object.
        /// </summary>
        public App()
        {
            // Global handler for uncaught exceptions.
            UnhandledException += Application_UnhandledException;

            // Standard XAML initialization
            InitializeComponent();

            // Phone-specific initialization
            InitializePhoneApplication();

            // Language display initialization
            InitializeLanguage();

            // Show graphics profiling information while debugging.
            if (Debugger.IsAttached)
            {
                // Display the current frame rate counters.
                //Application.Current.Host.Settings.EnableFrameRateCounter = true;

                // Show the areas of the app that are being redrawn in each frame.
                //Application.Current.Host.Settings.EnableRedrawRegions = true;

                // Enable non-production analysis visualization mode,
                // which shows areas of a page that are handed off to GPU with a colored overlay.
                //Application.Current.Host.Settings.EnableCacheVisualization = true;

                // Prevent the screen from turning off while under the debugger by disabling
                // the application's idle detection.
                // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
                // and consume battery power when the user is not using the phone.
                PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
            }
#if DEBUG
            MockIAP.Init();

            MockIAP.RunInMockMode(true);
            MockIAP.SetListingInformation(1, "en-us", "A description", "1", "TestApp");
            StreamResourceInfo xml        = Application.GetResourceStream(new Uri("MockProducts.xml", UriKind.Relative));
            XElement           appDataXml = XElement.Load(xml.Stream);
            MockIAP.PopulateIAPItemsFromXml(appDataXml.ToString());

            MockIAP.ClearCache();
#endif
        }
コード例 #12
0
        private void InitializeMockIAP()
        {
#if (DEBUG && BETA) || DEBUG
            MockIAP.Init();
            MockIAP.RunInMockMode(true);
            MockIAP.SetListingInformation(1, "en-us", string.Empty, "0.99", "Voice Memos");

            // Add some more items manually.

            ProductListing p = new ProductListing
            {
                Name           = "Voice Memos Premium",
                ImageUri       = new Uri("/Assets/IAPImages/Premium.png", UriKind.Relative),
                ProductId      = "VoiceMemosPremium",
                ProductType    = Windows.ApplicationModel.Store.ProductType.Durable,
                FormattedPrice = "$0.99",
                Tag            = string.Empty
            };

            MockIAP.AddProductListing("VoiceMemosPremium", p);
#endif
        }
コード例 #13
0
        private void SetupMockIAP()
        {
#if DEBUG
            MockIAP.Init();

            MockIAP.RunInMockMode(true);
            MockIAP.SetListingInformation(1, "en-us", "Removes all playback limits", "3", "MusicPimp Premium");

            // Add some more items manually.
            ProductListing p = new ProductListing {
                Name           = "MusicPimp Premium",
                ImageUri       = new Uri("/Assets/Icons/browser.png", UriKind.Relative),
                ProductId      = "org.musicpimp.premium",
                ProductType    = Windows.ApplicationModel.Store.ProductType.Durable,
                Keywords       = new string[] { "premium" },
                Description    = "Removes all playback limits. Does not expire.",
                FormattedPrice = "€1.99",
                Tag            = string.Empty
            };
            MockIAP.AddProductListing("org.musicpimp.premium", p);
#endif
        }
コード例 #14
0
ファイル: MainPage.xaml.cs プロジェクト: jksulkow/KoalaQuest
        private void Browser_Loaded(object sender, RoutedEventArgs e)
        {
            // Load IAP Listing Information

#if DEBUG
            //Use Mock API instead of real store
            MockIAP.Init();
            MockIAP.RunInMockMode(true);
            MockIAP.SetListingInformation(1, "en-us", "Your App Description", "$1.99", "Your App Name");

            // initialize to empty product list in case debug IAP functionality is not needed
            string xml = @"<ProductListings></ProductListings>";

            var sri = App.GetResourceStream(new Uri("WindowsStoreProxy.xml", UriKind.Relative));
            if (sri != null)
            {
                System.Xml.Linq.XDocument doc = System.Xml.Linq.XDocument.Load(sri.Stream);
                xml = doc.ToString();
            }

            MockIAP.PopulateIAPItemsFromXml(xml);
#endif
        }
コード例 #15
0
        public static void ClearMockIAP()
        {
#if (DEBUG && BETA) || DEBUG
            MockIAP.ClearCache();
#endif
        }
コード例 #16
0
        /// <summary>
        /// Add a MEGA product as test product to the Mock Iap library
        /// </summary>
        /// <param name="product">MEGA product to add to Mock Iap</param>
        public static void AddProductToMockIap(Product product)
        {
            string productId = string.Empty;

            switch (product.AccountType)
            {
            case MAccountType.ACCOUNT_TYPE_PROI:
                switch (product.Months)
                {
                case 1:
                    productId = "mega.microsoftstore.pro1.oneMonth";
                    break;

                case 12:
                    productId = "mega.microsoftstore.pro1.oneYear";
                    break;
                }
                break;

            case MAccountType.ACCOUNT_TYPE_PROII:
                switch (product.Months)
                {
                case 1:
                    productId = "mega.microsoftstore.pro2.oneMonth";
                    break;

                case 12:
                    productId = "mega.microsoftstore.pro2.oneYear";
                    break;
                }
                break;

            case MAccountType.ACCOUNT_TYPE_PROIII:
                switch (product.Months)
                {
                case 1:
                    productId = "mega.microsoftstore.pro3.oneMonth";
                    break;

                case 12:
                    productId = "mega.microsoftstore.pro3.oneYear";
                    break;
                }
                break;

            case MAccountType.ACCOUNT_TYPE_LITE:
                switch (product.Months)
                {
                case 1:
                    productId = "mega.microsoftstore.prolite.oneMonth";
                    break;

                case 12:
                    productId = "mega.microsoftstore.prolite.oneYear`";
                    break;
                }
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            // Only add the products once
            if (!MockIAP.allProducts.ContainsKey(productId))
            {
                var p = new ProductListing
                {
                    Name           = product.Name + " (" + product.Months + " months)",
                    ProductId      = productId,
                    ImageUri       = null,
                    ProductType    = Windows.ApplicationModel.Store.ProductType.Durable,
                    Keywords       = new[] { productId },
                    Description    = product.Name,
                    FormattedPrice = product.Price,
                    Tag            = string.Empty
                };

                MockIAP.AddProductListing(productId, p);
            }
        }
コード例 #17
0
        private void SetupMockIAP()
        {
#if DEBUG
            MockIAP.Init();
            MockIAP.RunInMockMode(true);
            MockIAP.SetListingInformation(1, "en-us", "Some description", "1", "TestApp");

            // Add some more items manually.

            ProductListing p = new ProductListing
            {
                Name           = "img.1",
                ImageUri       = new Uri("/Res/Image/1.png", UriKind.Relative),
                ProductId      = "img.1",
                ProductType    = Windows.ApplicationModel.Store.ProductType.Durable,
                Keywords       = new string[] { "image" },
                Description    = "Nice image",
                FormattedPrice = "1.0",
                Tag            = string.Empty
            };

            MockIAP.AddProductListing("img.1", p);

            p = new ProductListing
            {
                Name           = "img.2",
                ImageUri       = new Uri("/Res/Image/2.png", UriKind.Relative),
                ProductId      = "img.2",
                ProductType    = Windows.ApplicationModel.Store.ProductType.Durable,
                Keywords       = new string[] { "image" },
                Description    = "Nice image",
                FormattedPrice = "1.0",
                Tag            = string.Empty
            };

            MockIAP.AddProductListing("img.2", p);

            p = new ProductListing
            {
                Name           = "img.3",
                ImageUri       = new Uri("/Res/Image/3.png", UriKind.Relative),
                ProductId      = "img.3",
                ProductType    = Windows.ApplicationModel.Store.ProductType.Durable,
                Keywords       = new string[] { "image" },
                Description    = "Nice image",
                FormattedPrice = "1.0",
                Tag            = string.Empty
            };

            MockIAP.AddProductListing("img.3", p);

            p = new ProductListing
            {
                Name           = "img.4",
                ImageUri       = new Uri("/Res/Image/4.png", UriKind.Relative),
                ProductId      = "img.4",
                ProductType    = Windows.ApplicationModel.Store.ProductType.Durable,
                Keywords       = new string[] { "image" },
                Description    = "Nice image",
                FormattedPrice = "1.0",
                Tag            = string.Empty
            };

            MockIAP.AddProductListing("img.4", p);

            p = new ProductListing
            {
                Name           = "img.5",
                ImageUri       = new Uri("/Res/Image/5.png", UriKind.Relative),
                ProductId      = "img.5",
                ProductType    = Windows.ApplicationModel.Store.ProductType.Durable,
                Keywords       = new string[] { "image" },
                Description    = "Nice image",
                FormattedPrice = "1.0",
                Tag            = string.Empty
            };

            MockIAP.AddProductListing("img.5", p);

            p = new ProductListing
            {
                Name           = "img.6",
                ImageUri       = new Uri("/Res/Image/6.png", UriKind.Relative),
                ProductId      = "img.6",
                ProductType    = Windows.ApplicationModel.Store.ProductType.Durable,
                Keywords       = new string[] { "image" },
                Description    = "Nice image",
                FormattedPrice = "1.0",
                Tag            = string.Empty
            };

            MockIAP.AddProductListing("img.6", p);
#endif
        }
コード例 #18
0
 private void SetupMockIAP()
 {
     MockIAP.Init();
     MockIAP.RunInMockMode(true);
     MockIAP.SetListingInformation(1, "en-us", "Some description", "1", "MOCK IAP");
 }