public void Handle(UpdateTileMessage message) { var url = message.Image.MediaUrl; if (message.Image.Width > 800 || message.Image.Height > 800) { // after much testing it appears that images > 800px cannot be used as tiles url = message.Image.Thumbnail.MediaUrl; } var content = TileContentFactory.CreateTileWidePeekImageAndText01(); content.TextBodyWrap.Text = message.Image.Title; content.Image.Src = url; content.Image.Alt = message.Image.Title; // Square image substitute var squareContent = TileContentFactory.CreateTileSquareImage(); squareContent.Image.Src = url; squareContent.Image.Alt = message.Image.Title; content.SquareContent = squareContent; _tileUpdateManager.UpdatePrimaryTile(content); _statusService.TemporaryMessage = "Tile Update sent for " + message.Image.Title; }
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()); }
public static async Task UpdateTile() { var article = SampleDataSource.GetItem("Group-1-Item-1"); var tileContent = TileContentFactory.CreateTileWideImageAndText01(); tileContent.TextCaptionWrap.Text = article.Title; tileContent.Image.Src = article.ImagePath; tileContent.Image.Alt = article.Subtitle; var squareContent = TileContentFactory.CreateTileSquareImage(); squareContent.Image.Src = article.ImagePath; squareContent.Image.Alt = article.Title; tileContent.SquareContent = squareContent; TileNotification notification = tileContent.CreateNotification(); TileUpdateManager .CreateTileUpdaterForApplication() .Update(notification); }
private static void SetDefaultValues(ModelBindingContext bindingContext, object model) { // When sending a wide tile in a notification, the payload also includes a square tile // because it is not guaranteed which will be displayed; the user has the option to choose // either representation in their Start screen. var wideTile = model as IWideTileNotificationContent; if (wideTile != null) { var tileImageUrl = bindingContext.ValueProvider.GetValue("AlternativeTileImage"); var tileText = bindingContext.ValueProvider.GetValue("AlternativeTileText"); if (tileImageUrl != null && tileText != null) { var squareTile = TileContentFactory.CreateTileSquarePeekImageAndText04(); squareTile.Image.Src = tileImageUrl.AttemptedValue; squareTile.TextBodyWrap.Text = tileText.AttemptedValue; wideTile.SquareContent = squareTile; return; } if (tileImageUrl != null) { var squareTile = TileContentFactory.CreateTileSquareImage(); squareTile.Image.Src = tileImageUrl.AttemptedValue; wideTile.SquareContent = squareTile; return; } if (tileText != null) { var squareTile = TileContentFactory.CreateTileSquareText04(); squareTile.TextBodyWrap.Text = tileText.AttemptedValue; wideTile.SquareContent = squareTile; } } // When sending a toast notification that has looping audio src, the Audio.Loop property should be set to true // and the Duration property should be set to Long, as specified by the WNS model. var toast = model as IToastNotificationContent; if (toast != null) { var result = bindingContext.ValueProvider.GetValue("Audio.Content"); if (result != null) { ToastAudioContent audioContent; if (Enum.TryParse <ToastAudioContent>(result.AttemptedValue, out audioContent)) { toast.Audio.Loop = audioContent == ToastAudioContent.LoopingAlarm || audioContent == ToastAudioContent.LoopingAlarm2 || audioContent == ToastAudioContent.LoopingCall || audioContent == ToastAudioContent.LoopingCall2; if (toast.Audio.Loop) { toast.Duration = ToastDuration.Long; } } } } }
protected override void CreateTile() { var applicationTile = TileContentFactory.CreateTileSquareImage(); var tileUpdater = TileUpdateManager.CreateTileUpdaterForApplication(CoreApplication.Id); tileUpdater.Clear(); applicationTile.Image.Src = this.ImagePath; var tileNotification = applicationTile.CreateNotification(); tileUpdater.Update(tileNotification); }
void UpdateTileWithWebImage() { ITileWideImageAndText01 tileContent = TileContentFactory.CreateTileWideImageAndText01(); tileContent.TextCaptionWrap.Text = "高清:撑杆跳伊辛巴耶娃4米70无缘奥运三连冠"; tileContent.Image.Src = "http://img1.gtimg.com/4/460/46005/4600509_980x1200_292.jpg"; tileContent.Image.Alt = "Web image"; ITileSquareImage squareContent = TileContentFactory.CreateTileSquareImage(); squareContent.Image.Src = "http://img1.gtimg.com/4/460/46005/4600509_980x1200_292.jpg"; squareContent.Image.Alt = "Web image"; tileContent.SquareContent = squareContent; TileUpdateManager.CreateTileUpdaterForApplication().Update(tileContent.CreateNotification()); }
protected override void CreateTile() { var applicationTile = TileContentFactory.CreateTileWidePeekImageAndText02(); var smallApplicationTile = TileContentFactory.CreateTileSquareImage(); var tileUpdater = TileUpdateManager.CreateTileUpdaterForApplication(CoreApplication.Id); tileUpdater.Clear(); applicationTile.Image.Src = this.ImagePath; smallApplicationTile.Image.Src = "Images/LiveTileImage_150x150.png"; applicationTile.SquareContent = smallApplicationTile; applicationTile.TextBody1.Text = this.Line1; applicationTile.TextBody2.Text = this.Line2; var tileNotification = applicationTile.CreateNotification(); tileUpdater.Update(tileNotification); }
protected override void CreateTile() { var applicationTile = TileContentFactory.CreateTileWideText01(); var smallApplicationTile = TileContentFactory.CreateTileSquareImage(); var tileUpdater = TileUpdateManager.CreateTileUpdaterForApplication(CoreApplication.Id); tileUpdater.Clear(); applicationTile.TextHeading.Text = this.Header; applicationTile.TextBody1.Text = this.Line1; applicationTile.TextBody2.Text = this.Line2; applicationTile.TextBody3.Text = this.Line3; applicationTile.TextBody4.Text = this.Line4; applicationTile.SquareContent = smallApplicationTile; var tileNotification = applicationTile.CreateNotification(); tileUpdater.Update(tileNotification); }
protected override void CreateTile() { var applicationTile = TileContentFactory.CreateTileWidePeekImageCollection01(); var smallApplicationTile = TileContentFactory.CreateTileSquareImage(); var tileUpdater = TileUpdateManager.CreateTileUpdaterForApplication(CoreApplication.Id); tileUpdater.Clear(); applicationTile.ImageMain.Src = this.ImagePath; smallApplicationTile.Image.Src = this.SmallImagePath; applicationTile.ImageSmallColumn1Row1.Src = this.SmallImageCollection1Path; applicationTile.ImageSmallColumn1Row2.Src = this.SmallImageCollection2Path; applicationTile.ImageSmallColumn2Row1.Src = this.SmallImageCollection3Path; applicationTile.ImageSmallColumn2Row2.Src = this.SmallImageCollection4Path; applicationTile.SquareContent = smallApplicationTile; var tileNotification = applicationTile.CreateNotification(); tileUpdater.Update(tileNotification); }
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()); }
public static void ShowliveTile(bool IsLiveTile1, string name) { string wideTilesrc = "ms-appx:///Assets/BigLiveTile1.jpg"; string smallTilesrc = "ms-appx:///Assets/SmallLiveTile1.jpg"; if (!IsLiveTile1) { wideTilesrc = "ms-appx:///Assets/BigLiveTile2.jpg"; smallTilesrc = "ms-appx:///Assets/SmallLiveTile2.jpg"; } // 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 = name; tileContent.Image.Src = wideTilesrc; tileContent.Image.Alt = "Live tile"; // 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 = smallTilesrc; squareContent.Image.Alt = "Live tile"; tileContent.SquareContent = squareContent; // Send the notification to the app's application tile. TileUpdateManager.CreateTileUpdaterForApplication().Update(tileContent.CreateNotification()); }
void SendTileNotification_Click(object sender, RoutedEventArgs e) { string scale; ResourceManager.Current.DefaultContext.QualifierValues.TryGetValue("Scale", out scale); ITileWideSmallImageAndText03 tileContent = TileContentFactory.CreateTileWideSmallImageAndText03(); tileContent.TextBodyWrap.Text = "graySquare.png in the xml is actually graySquare.scale-" + scale + ".png"; tileContent.Image.Src = "ms-appx:///images/graySquare.png"; tileContent.Image.Alt = "Gray square"; ITileSquareImage squareTileContent = TileContentFactory.CreateTileSquareImage(); squareTileContent.Image.Src = "ms-appx:///images/graySquare.png"; squareTileContent.Image.Alt = "Gray square"; tileContent.SquareContent = squareTileContent; TileUpdateManager.CreateTileUpdaterForApplication().Update(tileContent.CreateNotification()); OutputTextBlock.Text = MainPage.PrettyPrint(tileContent.GetContent()); }
protected override void CreateTile() { // to start do NOT include a small image // add the .RequireSquareContent = false // then add the small tile var applicationTile = TileContentFactory.CreateTileWideText01(); var smallApplicationTile = TileContentFactory.CreateTileSquareImage(); var tileUpdater = TileUpdateManager.CreateTileUpdaterForApplication(CoreApplication.Id); tileUpdater.Clear(); applicationTile.TextHeading.Text = this.Header; applicationTile.TextBody1.Text = this.Line1; applicationTile.TextBody2.Text = this.Line2; applicationTile.TextBody3.Text = this.Line3; applicationTile.TextBody4.Text = this.Line4; applicationTile.SquareContent = smallApplicationTile; var tileNotification = applicationTile.CreateNotification(); tileUpdater.Update(tileNotification); }