void UpdateTileWithImage_Click(object sender, RoutedEventArgs e) { // Note: This sample contains an additional project, NotificationsExtensions. // NotificationsExtensions exposes an object model for creating notifications, but you can also // modify the strings directly. See UpdateTileWithImageWithStringManipulation_Click for an example // Create notification content based on a visual template. ITileWideImageAndText01 tileContent = TileContentFactory.CreateTileWideImageAndText01(); tileContent.TextCaptionWrap.Text = "This tile notification uses ms-appx images"; tileContent.Image.Src = "ms-appx:///images/redWide.png"; tileContent.Image.Alt = "Red image"; // Users can resize tiles to square or wide. // Apps can choose to include only square assets (meaning the app's tile can never be wide), or // include both wide and square assets (the user can resize the tile to square or wide). // Apps should not include only wide assets. // Apps that support being wide should include square tile notifications since users // determine the size of the tile. // create the square template and attach it to the wide template ITileSquareImage squareContent = TileContentFactory.CreateTileSquareImage(); squareContent.Image.Src = "ms-appx:///images/graySquare.png"; squareContent.Image.Alt = "Gray image"; tileContent.SquareContent = squareContent; // Send the notification to the app's application tile. TileUpdateManager.CreateTileUpdaterForApplication().Update(tileContent.CreateNotification()); OutputTextBlock.Text = MainPage.PrettyPrint(tileContent.GetContent()); }
void SendTileNotificationWithQueryStrings_Click(object sender, RoutedEventArgs e) { ITileWideImageAndText01 tileContent = TileContentFactory.CreateTileWideImageAndText01(); tileContent.TextCaptionWrap.Text = "This tile notification uses query strings for the image src."; tileContent.Image.Src = ImageUrl.Text; tileContent.Image.Alt = "Web image"; // enable AddImageQuery on the notification tileContent.AddImageQuery = true; ITileSquareImage squareContent = TileContentFactory.CreateTileSquareImage(); squareContent.Image.Src = ImageUrl.Text; squareContent.Image.Alt = "Web image"; // include the square template. tileContent.SquareContent = squareContent; // send the notification to the app's application tile TileUpdateManager.CreateTileUpdaterForApplication().Update(tileContent.CreateNotification()); OutputTextBlock.Text = MainPage.PrettyPrint(tileContent.GetContent()); }
void UpdateTileWithWebImage_Click(object sender, RoutedEventArgs e) { // Note: This sample contains an additional project, NotificationsExtensions. // NotificationsExtensions exposes an object model for creating notifications, but you can also // modify the strings directly. See UpdateTileWithWebImageWithStringManipulation_Click for an example // Create notification content based on a visual template. ITileWideImageAndText01 tileContent = TileContentFactory.CreateTileWideImageAndText01(); tileContent.TextCaptionWrap.Text = "This tile notification uses web images."; // !Important! // The Internet (Client) capability must be checked in the manifest in the Capabilities tab // to display web images in tiles (either the http:// or https:// protocols) tileContent.Image.Src = ImageUrl.Text; tileContent.Image.Alt = "Web image"; // Users can resize tiles to square or wide. // Apps can choose to include only square assets (meaning the app's tile can never be wide), or // include both wide and square assets (the user can resize the tile to square or wide). // Apps cannot include only wide assets. // Apps that support being wide should include square tile notifications since users // determine the size of the tile. // Create square notification content based on a visual template. ITileSquareImage squareContent = TileContentFactory.CreateTileSquareImage(); squareContent.Image.Src = ImageUrl.Text; squareContent.Image.Alt = "Web image"; // include the square template. tileContent.SquareContent = squareContent; // send the notification to the app's application tile TileUpdateManager.CreateTileUpdaterForApplication().Update(tileContent.CreateNotification()); OutputTextBlock.Text = MainPage.PrettyPrint(tileContent.GetContent()); }