public static void AddProductListing(string key, ProductListing productListing) { CheckIfInitialized(); if (_appListingInformation == null) { throw new Exception("A call to SetListingInformation is required before calling this method"); } if (allProducts == null) { allProducts = new Dictionary <string, ProductListing>(); } allProducts.Add(key, productListing); var store = new MockReceiptStore(); Dictionary <string, string> receipts = store.EnumerateReceipts(); // add a license for this item as well. var license = new ProductLicense { ExpirationDate = DateTimeOffset.Now, IsActive = receipts.ContainsKey(productListing.ProductId), IsConsumable = productListing.ProductType == ProductType.Consumable, ProductId = productListing.ProductId }; _appLicenseInformation.ProductLicenses.Add(productListing.ProductId, license); }
// Summary: // Not implemented for Windows Phone. Gets the license expiration date and time // relative to the system clock. // // Returns: // The date and time that the app's trial license will expire. public LicenseInformation(Windows.ApplicationModel.Store.LicenseInformation li) { IsActive = li.IsActive; IsTrial = li.IsTrial; ExpirationDate = li.ExpirationDate; ProductLicenses = new Dictionary <string, ProductLicense>(); foreach (string key in li.ProductLicenses.Keys) { ProductLicenses.Add(key, ProductLicense.Create(li.ProductLicenses[key])); } }
public static ProductLicense Create(Windows.ApplicationModel.Store.ProductLicense source) { var license = new ProductLicense { ExpirationDate = source.ExpirationDate, IsConsumable = source.IsConsumable, IsActive = source.IsActive, ProductId = source.ProductId }; return(license); }
public static ProductLicense Create(Windows.ApplicationModel.Store.ProductLicense source) { var license = new ProductLicense { ExpirationDate = source.ExpirationDate, IsConsumable = source.IsConsumable, IsActive = source.IsActive, ProductId = source.ProductId }; return license; }