/// <summary> /// Populates the page with content passed during navigation. Any saved state is also /// provided when recreating a page from a prior session. /// </summary> /// <param name="sender"> /// The source of the event; typically <see cref="NavigationHelper"/> /// </param> /// <param name="e">Event data that provides both the navigation parameter passed to /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and /// a dictionary of state preserved by this page during an earlier /// session. The state will be null the first time a page is visited.</param> private async void navigationHelper_LoadState(object sender, LoadStateEventArgs e) { // TODO: Assign a collection of bindable groups to this.DefaultViewModel["Groups"] product = await ProductDataSource.GetDetailsAsync(e.NavigationParameter.ToString()); this.defaultViewModel["ProductDetails"] = product; this.defaultViewModel["ProductName"] = product.Name; }
/// <summary> /// This method takes a Product as its input and generates an XML Document which contains the actual values to /// be displayed in the live tile. /// </summary> /// <param name="job">An object of Product class for getting the actual content to be shown</param> /// <returns>An XML document which is used for generating the live tile content</returns> private XmlDocument CreateWideTile(Product product) { // Create a live update for a wide tile XmlDocument wideTileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWide310x150SmallImageAndText04); // Assign text XmlNodeList wideTileTextAttributes = wideTileXml.GetElementsByTagName("text"); wideTileTextAttributes[0].AppendChild(wideTileXml.CreateTextNode(product.Price.ToString("C"))); wideTileTextAttributes[1].AppendChild(wideTileXml.CreateTextNode(product.Name)); // Assign Image XmlNodeList wideTileImageAttributes = wideTileXml.GetElementsByTagName("image"); ((XmlElement)wideTileImageAttributes[0]).SetAttribute("src", product.ImagePath); ((XmlElement)wideTileImageAttributes[0]).SetAttribute("alt", "Contoso Electronics logo"); return wideTileXml; }