コード例 #1
0
ファイル: StoreManager.cs プロジェクト: yanivnizan/wp-store
        /// <summary>   Loads Windows Store IAP informations. </summary>
        public async void LoadListingInfo()
        {
            StoreEvents.GetInstance().PostMarketItemsRefreshStartedEvent();
            try
            {
                if (StoreConfig.STORE_TEST_MODE)
                {
                    listingInfosMock = await MockStore.CurrentApp.LoadListingInformationAsync();

                    marketProductInfos.Clear();
                    if (listingInfosMock.ProductListings.Count > 0)
                    {
                        foreach (KeyValuePair <string, MockStore.ProductListing> pair in listingInfosMock.ProductListings)
                        {
                            MarketProductInfos marketProduct = new MarketProductInfos();
                            marketProduct.Name           = pair.Value.Name;
                            marketProduct.Description    = pair.Value.Description;
                            marketProduct.FormattedPrice = pair.Value.FormattedPrice;
                            marketProduct.ImageUri       = pair.Value.ImageUri;
                            marketProduct.Keywords       = pair.Value.Keywords;
                            marketProduct.ProductId      = pair.Value.ProductId;

                            switch (pair.Value.ProductType)
                            {
                            case Windows.ApplicationModel.Store.ProductType.Consumable:
                                marketProduct.ProductType = MarketProductInfos.MarketProductType.CONSUMABLE;
                                break;

                            case Windows.ApplicationModel.Store.ProductType.Durable:
                                marketProduct.ProductType = MarketProductInfos.MarketProductType.DURABLE;
                                break;

                            case Windows.ApplicationModel.Store.ProductType.Unknown:
                                marketProduct.ProductType = MarketProductInfos.MarketProductType.UNKNOWN;
                                break;
                            }
                            marketProduct.Tag = pair.Value.Tag;
                            marketProductInfos.Add(pair.Key, marketProduct);
                        }
                    }
                }
                else
                {
                    listingInfos = await Store.CurrentApp.LoadListingInformationAsync();

                    IReadOnlyDictionary <string, Store.ProductListing> productListing;
                    productListing = listingInfos.ProductListings;

                    marketProductInfos.Clear();
                    if (productListing.Count > 0)
                    {
                        foreach (KeyValuePair <string, Store.ProductListing> pair in listingInfos.ProductListings)
                        {
                            MarketProductInfos marketProduct = new MarketProductInfos();
                            marketProduct.Name           = pair.Value.Name;
                            marketProduct.Description    = pair.Value.Description;
                            marketProduct.FormattedPrice = pair.Value.FormattedPrice;
                            marketProduct.ImageUri       = pair.Value.ImageUri;
                            marketProduct.Keywords       = pair.Value.Keywords;
                            marketProduct.ProductId      = pair.Value.ProductId;

                            switch (pair.Value.ProductType)
                            {
                            case Windows.ApplicationModel.Store.ProductType.Consumable:
                                marketProduct.ProductType = MarketProductInfos.MarketProductType.CONSUMABLE;
                                break;

                            case Windows.ApplicationModel.Store.ProductType.Durable:
                                marketProduct.ProductType = MarketProductInfos.MarketProductType.DURABLE;
                                break;

                            case Windows.ApplicationModel.Store.ProductType.Unknown:
                                marketProduct.ProductType = MarketProductInfos.MarketProductType.UNKNOWN;
                                break;
                            }
                            marketProduct.Tag = pair.Value.Tag;
                            marketProductInfos.Add(pair.Key, marketProduct);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                SoomlaUtils.LogDebug(TAG, e.Message);
            }

            OnListingLoadedCB(marketProductInfos);
        }
コード例 #2
0
ファイル: StoreManager.cs プロジェクト: yanivnizan/wp-store
        /// <summary>   Loads Windows Store IAP informations. </summary>
        public async void LoadListingInfo()
        {
            StoreEvents.GetInstance().PostMarketItemsRefreshStartedEvent();
            try
            {

                
                if (StoreConfig.STORE_TEST_MODE)
                {
                    listingInfosMock = await MockStore.CurrentApp.LoadListingInformationAsync();

                    marketProductInfos.Clear();
                    if (listingInfosMock.ProductListings.Count > 0)
                    {
                        foreach (KeyValuePair<string, MockStore.ProductListing> pair in listingInfosMock.ProductListings)
                        {
                            MarketProductInfos marketProduct = new MarketProductInfos();
                            marketProduct.Name = pair.Value.Name;
                            marketProduct.Description = pair.Value.Description;
                            marketProduct.FormattedPrice = pair.Value.FormattedPrice;
                            marketProduct.ImageUri = pair.Value.ImageUri;
                            marketProduct.Keywords = pair.Value.Keywords;
                            marketProduct.ProductId = pair.Value.ProductId;

                            switch (pair.Value.ProductType)
                            {
                                case Windows.ApplicationModel.Store.ProductType.Consumable:
                                    marketProduct.ProductType = MarketProductInfos.MarketProductType.CONSUMABLE;
                                    break;
                                case Windows.ApplicationModel.Store.ProductType.Durable:
                                    marketProduct.ProductType = MarketProductInfos.MarketProductType.DURABLE;
                                    break;
                                case Windows.ApplicationModel.Store.ProductType.Unknown:
                                    marketProduct.ProductType = MarketProductInfos.MarketProductType.UNKNOWN;
                                    break;
                            }
                            marketProduct.Tag = pair.Value.Tag;
                            marketProductInfos.Add(pair.Key, marketProduct);
                        }
                    }
                }
                else
                {
                    listingInfos = await Store.CurrentApp.LoadListingInformationAsync();
                    IReadOnlyDictionary<string, Store.ProductListing> productListing;
                    productListing = listingInfos.ProductListings;

                    marketProductInfos.Clear();
                    if (productListing.Count > 0)
                    {
                        foreach (KeyValuePair<string, Store.ProductListing> pair in listingInfos.ProductListings)
                        {
                            MarketProductInfos marketProduct = new MarketProductInfos();
                            marketProduct.Name = pair.Value.Name;
                            marketProduct.Description = pair.Value.Description;
                            marketProduct.FormattedPrice = pair.Value.FormattedPrice;
                            marketProduct.ImageUri = pair.Value.ImageUri;
                            marketProduct.Keywords = pair.Value.Keywords;
                            marketProduct.ProductId = pair.Value.ProductId;

                            switch (pair.Value.ProductType)
                            {
                                case Windows.ApplicationModel.Store.ProductType.Consumable:
                                    marketProduct.ProductType = MarketProductInfos.MarketProductType.CONSUMABLE;
                                    break;
                                case Windows.ApplicationModel.Store.ProductType.Durable:
                                    marketProduct.ProductType = MarketProductInfos.MarketProductType.DURABLE;
                                    break;
                                case Windows.ApplicationModel.Store.ProductType.Unknown:
                                    marketProduct.ProductType = MarketProductInfos.MarketProductType.UNKNOWN;
                                    break;
                            }
                            marketProduct.Tag = pair.Value.Tag;
                            marketProductInfos.Add(pair.Key, marketProduct);
                        }
                    }
                }

            }
            catch (Exception e)
            {
                SoomlaUtils.LogDebug(TAG,e.Message);
            }

            OnListingLoadedCB(marketProductInfos);
        }