Beispiel #1
0
        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);
        }
        public ListingInformation(Windows.ApplicationModel.Store.ListingInformation listingInformation)
        {
            AgeRating      = listingInformation.AgeRating;
            CurrentMarket  = listingInformation.CurrentMarket;
            Description    = listingInformation.Description;
            FormattedPrice = listingInformation.FormattedPrice;
            Name           = listingInformation.Name;

            ProductListings = new Dictionary <string, ProductListing>();
            foreach (var keyValuePair in listingInformation.ProductListings)
            {
                ProductListings.Add(keyValuePair.Key, new ProductListing(keyValuePair.Value));
            }
        }
Beispiel #3
0
        public ListingInformation(Windows.ApplicationModel.Store.ListingInformation source)
        {
            AgeRating       = source.AgeRating;
            CurrentMarket   = source.CurrentMarket;
            Description     = source.Description;
            FormattedPrice  = source.FormattedPrice;
            Name            = source.Name;
            ProductListings = new Dictionary <string, ProductListing>();

            foreach (string key in source.ProductListings.Keys)
            {
                ProductListings.Add(key, ProductListing.Create(source.ProductListings[key]));
            }
        }
Beispiel #4
0
        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);
        }