コード例 #1
0
ファイル: CurrentApp.cs プロジェクト: malliina/musicpimp-win
        public static async Task <ListingInformation> LoadListingInformationByProductIdsAsync(string[] ProductIds)
        {
            MockIAP.CheckIfInitialized();

            ListingInformation listingInformation;

            if (!MockIAP.MockMode)
            {
                Windows.ApplicationModel.Store.ListingInformation li = await Windows.ApplicationModel.Store.CurrentApp.LoadListingInformationByProductIdsAsync(ProductIds);

                listingInformation = new ListingInformation(li);
            }
            else
            {
                listingInformation = MockIAP.GetListingInformation();
                listingInformation.ProductListings = new Dictionary <string, ProductListing>();

                IEnumerable <string> result = from key in MockIAP.allProducts.Keys
                                              join pId in ProductIds on MockIAP.allProducts[key].ProductId equals pId
                                              select key;

                result.ToList().ForEach(k => listingInformation.ProductListings.Add(k, MockIAP.allProducts[k]));
            }

            return(listingInformation);
        }
コード例 #2
0
ファイル: CurrentApp.cs プロジェクト: malliina/musicpimp-win
        public static void ReportProductFulfillment(string selectedProductId)
        {
            MockIAP.CheckIfInitialized();

            if (!MockIAP.MockMode)
            {
                Windows.ApplicationModel.Store.CurrentApp.ReportProductFulfillment(selectedProductId);
            }
            else
            {
                MockIAP.ReportFulfillment(selectedProductId);
            }
        }
コード例 #3
0
ファイル: CurrentApp.cs プロジェクト: malliina/musicpimp-win
        public static async Task <string> RequestProductPurchaseAsync(string ProductId, bool includeReceipt)
        {
            MockIAP.CheckIfInitialized();

            string receipt;

            if (!MockIAP.MockMode)
            {
                receipt = await Windows.ApplicationModel.Store.CurrentApp.RequestProductPurchaseAsync(ProductId, includeReceipt);

                // Now we refresh the license information post purchase.
                LicenseInformation = new LicenseInformation(Windows.ApplicationModel.Store.CurrentApp.LicenseInformation);
            }
            else
            {
                receipt = MockIAP.SimulatePurchase(ProductId, includeReceipt);
            }

            return(receipt);
        }
コード例 #4
0
ファイル: CurrentApp.cs プロジェクト: malliina/musicpimp-win
        public static async Task <ListingInformation> LoadListingInformationAsync()
        {
            MockIAP.CheckIfInitialized();

            ListingInformation listingInformation;

            if (!MockIAP.MockMode)
            {
                Windows.ApplicationModel.Store.ListingInformation li = await Windows.ApplicationModel.Store.CurrentApp.LoadListingInformationAsync();

                listingInformation = new ListingInformation(li);

                LicenseInformation = new LicenseInformation(Windows.ApplicationModel.Store.CurrentApp.LicenseInformation);
            }
            else
            {
                listingInformation = MockIAP.GetListingInformation();
                listingInformation.ProductListings = MockIAP.allProducts;
            }

            return(listingInformation);
        }
コード例 #5
0
ファイル: CurrentApp.cs プロジェクト: malliina/musicpimp-win
        public static async Task <string> GetProductReceiptAsync(string selectedProductId)
        {
            MockIAP.CheckIfInitialized();

            string receipt = null;

            if (!MockIAP.MockMode)
            {
                receipt = await Windows.ApplicationModel.Store.CurrentApp.GetProductReceiptAsync(selectedProductId);
            }
            else
            {
                var rs = new MockReceiptStore();
                Dictionary <string, string> receipts = rs.EnumerateReceipts();
                if (receipts.ContainsKey(selectedProductId))
                {
                    receipt = receipts[selectedProductId];
                }
            }

            return(receipt);
        }