public static void EnableDebugWindowsStoreProxy(LicenseChangedHandler licenseChangedHandler, DebugApp debugApp, params DebugProduct[] debugProducts) { #if NETFX_CORE XElement proxyXML = SerializeStoreProxyToXML(debugApp, debugProducts); using (StringWriter proxyXMLWriter = new StringWriter()) { proxyXML.Save(proxyXMLWriter, SaveOptions.DisableFormatting); EnableDebugWindowsStoreProxy(licenseChangedHandler, proxyXMLWriter.ToString()); } #endif }
// Internal Windows-only functions protected static XElement SerializeStoreProxyToXML(DebugApp debugApp, params DebugProduct[] debugProducts) { XElement listingInfo = new XElement("ListingInformation", new XElement("App", new XElement("AppId", debugApp.AppId.ToString()), new XElement("LinkUri", debugApp.LinkUri.ToString()), new XElement("CurrentMarket", debugApp.CurrentMarket), new XElement("AgeRating", debugApp.AgeRating), new XElement("MarketData", new XAttribute(XNamespace.Xml + "lang", debugApp.CurrentMarket.ToLower()), new XElement("Name", debugApp.Name), new XElement("Description", debugApp.Description), new XElement("Price", debugApp.Price.ToString("F2")), new XElement("CurrencySymbol", debugApp.CurrencySymbol), new XElement("CurrencyCode", debugApp.CurrencyCode)))); XElement licenseInfo = new XElement("LicenseInformation", new XElement("App", new XElement("IsActive", debugApp.IsActive), new XElement("IsTrial", debugApp.IsTrial))); foreach (DebugProduct debugProduct in debugProducts) { listingInfo.Add(new XElement("Product", new XAttribute("ProductId", debugProduct.ProductId), new XElement("MarketData", new XAttribute(XNamespace.Xml + "lang", debugApp.CurrentMarket.ToLower()), new XElement("Name", debugProduct.Name), new XElement("Price", debugProduct.Price.ToString("F2")), new XElement("CurrencySymbol", debugProduct.CurrencySymbol), new XElement("CurrencyCode", debugProduct.CurrencyCode)))); licenseInfo.Add(new XElement(new XElement("Product", new XAttribute("ProductId", debugProduct.ProductId), new XElement("IsActive", debugProduct.IsActive)))); } return new XElement("CurrentApp", listingInfo, licenseInfo); }
public static void EnableDebugWindowsStoreProxy(DebugApp debugApp, params DebugProduct[] debugProducts) { EnableDebugWindowsStoreProxy(null, debugApp, debugProducts); }