/// <summary> /// Creates a new ProductLicense class based on a listing supplied directly from the Windows Store APIs /// </summary> /// <param name="source">An original Windows.ApplicationModel.Store.ProductLicense from the CurrentApp class</param> /// <returns>A populated ProductLicense class</returns> public static ProductLicense Create(Windows.ApplicationModel.Store.ProductLicense source) { var productLicense = new ProductLicense { #if WINDOWS_PHONE //Windows Phone 8 ExpirationDate = DateTimeOffset.MaxValue, //MaxValue means that the license is active and will not expire IsConsumable = source.IsConsumable, #else //WinRT ExpirationDate = source.ExpirationDate, #endif IsActive = source.IsActive, ProductId = source.ProductId }; return(productLicense); }
#pragma warning restore 67 /// <summary> /// Creates a LicenseInformation class based upon a Windows.ApplicationModel.Store.LicenseInformation object /// </summary> /// <param name="source">A valid Windows.ApplicationModel.Store.LicenseInformation object</param> /// <returns>A LicenseInformation class with all properties mapped from source</returns> public static LicenseInformation Create(Windows.ApplicationModel.Store.LicenseInformation source) { var licenseInformation = new LicenseInformation() { IsActive = source.IsActive, IsTrial = source.IsTrial, ExpirationDate = source.ExpirationDate, ProductLicenses = source.ProductLicenses.ToDictionary(key => key.Key, value => ProductLicense.Create(value.Value)) }; #if WINDOWS_PHONE && !DEBUG //The Windows Phone new Microsoft.Phone.Marketplace.LicenseInformation().IsTrial(); is what really determines the Trial vs. Full license status in production for WP8 licenseInformation.IsTrial = new Microsoft.Phone.Marketplace.LicenseInformation().IsTrial(); #endif return(licenseInformation); }
/// <summary> /// Overload to be used by the CurrentAppSimulator for Windows Phone 8; decided /// that this was a nicer way to do it than a bunch more IFDEFs /// </summary> /// <param name="clone">A fully instantiated ProductLicense implementation</param> /// <returns>The initial ProductLicense implementation</returns> public static ProductLicense Create(ProductLicense clone) { return(clone); }