private void UpdateTile() { TileUpdateManager.CreateTileUpdaterForApplication().Clear(); ITileWidePeekImage05 tileContent = TileContentFactory.CreateTileWidePeekImage05(); tileContent.ImageMain.Src = "http://ww3.sinaimg.cn/bmiddle/643be833jw1e5jg5horgij20dc0hsabq.jpg"; tileContent.ImageSecondary.Src = "http://ww1.sinaimg.cn/bmiddle/643be833jw1e5jg5ioqhpj20dc0hsmyk.jpg"; tileContent.TextHeading.Text = "可可曾"; tileContent.TextBodyWrap.Text = "Mat" + ":" + "马童"; /* * ITileSquareImage squareContent = TileContentFactory.CreateTileSquareImage(); * * squareContent.Image.Src = "http://ww4.sinaimg.cn/bmiddle/643be833jw1e5jg5l8dapj20hs0dcwga.jpg"; * squareContent.Image.Alt = "Web image"; */ ITileSquarePeekImageAndText02 squareImageAndTextContent = TileContentFactory.CreateTileSquarePeekImageAndText02(); squareImageAndTextContent.Image.Src = "http://ww4.sinaimg.cn/bmiddle/643be833jw1e5jg5l8dapj20hs0dcwga.jpg"; squareImageAndTextContent.Image.Alt = "Web image"; squareImageAndTextContent.TextHeading.Text = string.Format("{0:t}", DateTime.Now); squareImageAndTextContent.TextBodyWrap.Text = "Here is some text that is displayed on the peek"; // include the square template. //tileContent.SquareContent = squareContent; tileContent.SquareContent = squareImageAndTextContent; // send the notification to the app's application tile TileUpdateManager.CreateTileUpdaterForApplication().Update(tileContent.CreateNotification()); }
public static void UpdateTileWithWidePeekImages(List <NotificationTile> notificationTileList) { if (notificationTileList != null && notificationTileList.Count > 0) { for (int i = 0; i < notificationTileList.Count; i++) { if (i < 5) { TileUpdateManager.CreateTileUpdaterForApplication().EnableNotificationQueue(true); TileUpdateManager.CreateTileUpdaterForApplication().Clear(); ITileWidePeekImage05 tileContent = TileContentFactory.CreateTileWidePeekImage05(); tileContent.ImageMain.Src = tileContent.ImageSecondary.Src = notificationTileList[i].ImageUri; tileContent.ImageMain.Alt = tileContent.ImageSecondary.Alt = notificationTileList[i].ImageAltName; if (notificationTileList[i].TextHeading.Length > 30) { tileContent.TextHeading.Text = notificationTileList[i].TextHeading.Substring(0, 30); } else { tileContent.TextHeading.Text = notificationTileList[i].TextHeading; } if (notificationTileList[i].TextBodyWrap.Length > 80) { tileContent.TextBodyWrap.Text = notificationTileList[i].TextBodyWrap.Substring(0, 80); } else { tileContent.TextBodyWrap.Text = notificationTileList[i].TextBodyWrap; } ITileSquarePeekImageAndText02 squareImageAndTextContent = TileContentFactory.CreateTileSquarePeekImageAndText02(); squareImageAndTextContent.Image.Src = notificationTileList[i].ImageUri; squareImageAndTextContent.Image.Alt = notificationTileList[i].ImageAltName; squareImageAndTextContent.TextHeading.Text = notificationTileList[i].TextHeading; squareImageAndTextContent.TextBodyWrap.Text = notificationTileList[i].TextBodyWrap; tileContent.SquareContent = squareImageAndTextContent; TileUpdateManager.CreateTileUpdaterForApplication().Update(tileContent.CreateNotification()); } } } }
/// <summary> /// Sample Merged tiles with images and text /// </summary> /// <param name="updater"></param> public static void UpdateTileWithWidePeekImage(NotificationTile notificationTile) { if (notificationTile != null) { TileUpdateManager.CreateTileUpdaterForApplication().EnableNotificationQueue(false); TileUpdateManager.CreateTileUpdaterForApplication().Clear(); ITileWidePeekImage05 tileContent = TileContentFactory.CreateTileWidePeekImage05(); tileContent.ImageMain.Src = tileContent.ImageSecondary.Src = notificationTile.ImageUri; tileContent.ImageMain.Alt = tileContent.ImageSecondary.Alt = notificationTile.ImageAltName; if (notificationTile.TextHeading.Length > 30) { tileContent.TextHeading.Text = notificationTile.TextHeading.Substring(0, 30); } else { tileContent.TextHeading.Text = notificationTile.TextHeading; } if (notificationTile.TextBodyWrap.Length > 80) { tileContent.TextBodyWrap.Text = notificationTile.TextBodyWrap.Substring(0, 80); } else { tileContent.TextBodyWrap.Text = notificationTile.TextBodyWrap; } ITileSquarePeekImageAndText02 squareImageAndTextContent = TileContentFactory.CreateTileSquarePeekImageAndText02(); squareImageAndTextContent.Image.Src = notificationTile.ImageUri; squareImageAndTextContent.Image.Alt = notificationTile.ImageAltName; squareImageAndTextContent.TextHeading.Text = notificationTile.TextHeading; squareImageAndTextContent.TextBodyWrap.Text = notificationTile.TextBodyWrap; tileContent.SquareContent = squareImageAndTextContent; TileUpdateManager.CreateTileUpdaterForApplication().Update(tileContent.CreateNotification()); } }
private static void UpdateSecondaryTileWithImage(string tileId, NotificationTile notificationTile, NotificationSecondaryTileType tileType) { if (!string.IsNullOrEmpty(tileId) && !string.IsNullOrWhiteSpace(tileId) && notificationTile != null) { TileUpdateManager.CreateTileUpdaterForSecondaryTile(tileId).EnableNotificationQueue(false); TileUpdateManager.CreateTileUpdaterForSecondaryTile(tileId).Clear(); ITileSquarePeekImageAndText02 squareImageAndTextContent = TileContentFactory.CreateTileSquarePeekImageAndText02(); squareImageAndTextContent.Image.Src = notificationTile.ImageUri; squareImageAndTextContent.Image.Alt = notificationTile.ImageAltName; squareImageAndTextContent.TextHeading.Text = notificationTile.TextHeading; squareImageAndTextContent.TextBodyWrap.Text = notificationTile.TextBodyWrap; if (tileType == NotificationSecondaryTileType.CustomTile) { ITileWideImageAndText01 tileContent = TileContentFactory.CreateTileWideImageAndText01(); tileContent.Image.Src = notificationTile.ImageUri; tileContent.Image.Alt = notificationTile.ImageAltName; tileContent.TextCaptionWrap.Text = notificationTile.TextBodyWrap; tileContent.SquareContent = squareImageAndTextContent; TileUpdateManager.CreateTileUpdaterForSecondaryTile(tileId).Update(tileContent.CreateNotification()); } else { ITileWidePeekImage05 tileContent = TileContentFactory.CreateTileWidePeekImage05(); tileContent.ImageMain.Src = tileContent.ImageSecondary.Src = notificationTile.ImageUri; tileContent.ImageMain.Alt = tileContent.ImageSecondary.Alt = notificationTile.ImageAltName; tileContent.TextHeading.Text = notificationTile.TextHeading; tileContent.TextBodyWrap.Text = notificationTile.TextBodyWrap; tileContent.SquareContent = squareImageAndTextContent; TileUpdateManager.CreateTileUpdaterForSecondaryTile(tileId).Update(tileContent.CreateNotification()); } } }