void SendTileNotificationWithQueryStrings_Click(object sender, RoutedEventArgs e) { ITileSquare310x310Image square310x310TileContent = TileContentFactory.CreateTileSquare310x310Image(); square310x310TileContent.Image.Src = ImageUrl.Text; square310x310TileContent.Image.Alt = "Web image"; // enable AddImageQuery on the notification square310x310TileContent.AddImageQuery = true; ITileWide310x150ImageAndText01 wide310x150TileContent = TileContentFactory.CreateTileWide310x150ImageAndText01(); wide310x150TileContent.TextCaptionWrap.Text = "This tile notification uses query strings for the image src."; wide310x150TileContent.Image.Src = ImageUrl.Text; wide310x150TileContent.Image.Alt = "Web image"; ITileSquare150x150Image square150x150TileContent = TileContentFactory.CreateTileSquare150x150Image(); square150x150TileContent.Image.Src = ImageUrl.Text; square150x150TileContent.Image.Alt = "Web image"; ITileSquare71x71Image square71x71TileContent = TileContentFactory.CreateTileSquare71x71Image(); square71x71TileContent.Image.Src = ImageUrl.Text; square71x71TileContent.Image.Alt = "Web image"; square150x150TileContent.Square71x71Content = square71x71TileContent; wide310x150TileContent.Square150x150Content = square150x150TileContent; square310x310TileContent.Wide310x150Content = wide310x150TileContent; TileUpdateManager.CreateTileUpdaterForApplication().Update(square310x310TileContent.CreateNotification()); OutputTextBlock.Text = MainPage.PrettyPrint(square310x310TileContent.GetContent()); rootPage.NotifyUser("Tile notification with image query strings sent.", NotifyType.StatusMessage); }
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 // Users can resize any app tile to the small (Square70x70 on Windows 8.1, Square71x71 on Windows Phone 8.1) and medium (Square150x150) tile sizes. // These are both tile sizes an app must minimally support. // An app can additionally support the wide (Wide310x150) tile size as well as the large (Square310x310) tile size. // Note that in order to support a large (Square310x310) tile size, an app must also support the wide (Wide310x150) tile size (but not vice versa). // This sample application supports all four tile sizes: small, medium, wide and large. // This means that the user may have resized their tile to any of these four sizes for their custom Start screen layout. // Because an app has no way of knowing what size the user resized their app tile to, an app should include template bindings // for each supported tile sizes in their notifications. Only Windows Phone 8.1 supports small tile notifications. // We assemble one notification with four template bindings by including the content for each smaller // tile in the next size up. Square310x310 includes Wide310x150, which includes Square150x150, which includes Square71x71. // If we leave off the content for a tile size which the application supports, the user will not see the // notification if the tile is set to that size. // Create a notification for the Square310x310 tile using one of the available templates for the size. ITileSquare310x310Image tileContent = TileContentFactory.CreateTileSquare310x310Image(); tileContent.Image.Src = "ms-appx:///images/purpleSquare310x310.png"; tileContent.Image.Alt = "Purple image"; // Create a notification for the Wide310x150 tile using one of the available templates for the size. ITileWide310x150ImageAndText01 wide310x150Content = TileContentFactory.CreateTileWide310x150ImageAndText01(); wide310x150Content.TextCaptionWrap.Text = "This tile notification uses ms-appx images"; wide310x150Content.Image.Src = "ms-appx:///images/redWide310x150.png"; wide310x150Content.Image.Alt = "Red image"; // Create a notification for the Square150x150 tile using one of the available templates for the size. ITileSquare150x150Image square150x150Content = TileContentFactory.CreateTileSquare150x150Image(); square150x150Content.Image.Src = "ms-appx:///images/graySquare150x150.png"; square150x150Content.Image.Alt = "Gray image"; // Create a notification for the Square71x71 tile using one of the available templates for the size. ITileSquare71x71Image square71x71Content = TileContentFactory.CreateTileSquare71x71Image(); square71x71Content.Image.Src = "ms-appx:///images/graySquare150x150.png"; square71x71Content.Image.Alt = "Gray image"; // Attach the Square71x71 template to the Square150x150 template. square150x150Content.Square71x71Content = square71x71Content; // Attach the Square150x150 template to the Wide310x150 template. wide310x150Content.Square150x150Content = square150x150Content; // Attach the Wide310x150 to the Square310x310 template. tileContent.Wide310x150Content = wide310x150Content; // Send the notification to the application’s tile. TileUpdateManager.CreateTileUpdaterForApplication().Update(tileContent.CreateNotification()); OutputTextBlock.Text = MainPage.PrettyPrint(tileContent.GetContent()); rootPage.NotifyUser("Tile notification with local images sent", NotifyType.StatusMessage); }
public static void UpdateDefaultTile(bool transparentTile = false) { var tileSubFolder = transparentTile ? "Transparent" : "Solid"; var tileSquare71Content = TileContentFactory.CreateTileSquare71x71Image(); ITileNotificationContent biggerTile; tileSquare71Content.Image.Src = String.Format("ms-appx:///Assets/Tiles/{0}/Square71x71Logo.png", tileSubFolder); var tileSquare150Content = TileContentFactory.CreateTileSquare150x150Image(); tileSquare150Content.Image.Src = String.Format("ms-appx:///Assets/Tiles/{0}/Square150x150Logo.png", tileSubFolder); tileSquare150Content.Square71x71Content = tileSquare71Content; var tileWideContent = TileContentFactory.CreateTileWide310x150Image(); tileWideContent.Image.Src = String.Format("ms-appx:///Assets/Tiles/{0}/Wide310x150Logo.png", tileSubFolder); tileWideContent.Square150x150Content = tileSquare150Content; #if WINDOWS_PHONE_APP biggerTile = tileWideContent; #else var tileSquare310Content = TileContentFactory.CreateTileSquare310x310Image(); tileSquare310Content.Image.Src = String.Format("ms-appx:///Assets/Tiles/{0}/Square310x310Logo.png", tileSubFolder); tileSquare310Content.Wide310x150Content = tileWideContent; biggerTile = tileSquare310Content; #endif TileUpdateManager.CreateTileUpdaterForApplication().Update(biggerTile.CreateNotification()); }
public async Task <ISquare310x310TileNotificationContent> clearLiveTiles(string siteName) { await genTileImages(siteName); // Large tile. var largeContent = TileContentFactory.CreateTileSquare310x310Image(); largeContent.Image.Src = $"ms-appdata:///local/{siteName}LargeTile.png"; largeContent.Branding = NotificationsExtensions.TileContent.TileBranding.None; // Wide tile. var wideContent = TileContentFactory.CreateTileWide310x150Image(); wideContent.Image.Src = $"ms-appdata:///local/{siteName}WideTile.png"; wideContent.Branding = NotificationsExtensions.TileContent.TileBranding.None; // Square tile. var squareContent = TileContentFactory.CreateTileSquare150x150Image(); squareContent.Image.Src = $"ms-appdata:///local/{siteName}MedTile.png"; squareContent.Branding = NotificationsExtensions.TileContent.TileBranding.None; // Smaill tile. var smallContent = TileContentFactory.CreateTileSquare71x71Image(); smallContent.Image.Src = $"ms-appdata:///local/{siteName}SmallTile.png"; smallContent.Branding = NotificationsExtensions.TileContent.TileBranding.None; largeContent.Wide310x150Content = wideContent; wideContent.Square150x150Content = squareContent; squareContent.Square71x71Content = smallContent; return(largeContent); }
public async void UpdateAsync(long count) { try { var wideImage = await RenderAsync(new StartTileWide(count), 310, 150); if (wideImage == null) { return; } var wideName = await SaveFileAsync(wideImage, WideFileName, 310U, 150U); var squareImage = await RenderAsync(new StartTileSquare(count), 150, 150); if (squareImage == null) { return; } var squareName = await SaveFileAsync(squareImage, SquareFileName, 150U, 150U); var squareSmallImage = await RenderAsync(new StartTileSquareSmall(count), 71, 71); if (squareSmallImage == null) { return; } var squareSmallName = await SaveFileAsync(squareSmallImage, SquareSmallFileName, 71U, 71U); var tileWide = TileContentFactory.CreateTileWide310x150Image(); tileWide.StrictValidation = true; tileWide.Branding = TileBranding.Name; tileWide.Image.Src = "ms-appdata:///local/" + wideName; var tileSquare = TileContentFactory.CreateTileSquare150x150Image(); tileSquare.Branding = TileBranding.Name; tileSquare.Image.Src = "ms-appdata:///local/" + squareName; tileWide.Square150x150Content = tileSquare; var tileSquareSmall = TileContentFactory.CreateTileSquare71x71Image(); tileSquareSmall.Branding = TileBranding.None; tileSquareSmall.Image.Src = "ms-appdata:///local/" + squareSmallName; tileSquare.Square71x71Content = tileSquareSmall; var tileNotification = tileWide.CreateNotification(); tileNotification.ExpirationTime = DateTimeOffset.Now.AddDays(1D); var tileUpdater = TileUpdateManager.CreateTileUpdaterForApplication(); tileUpdater.Clear(); tileUpdater.Update(tileNotification); } catch (Exception ex) { _telemetryClient.TrackException(ex); } }
/// <summary> /// 支持大/宽/中/小磁贴的更新 /// </summary> /// <param name="largeTileGrid"></param> /// <param name="wideTileGrid"></param> /// <param name="mediumTileGrid"></param> /// <param name="smallTileGrid"></param> /// <returns></returns> public async static Task <bool> UpdateTileForWindows(UIElement largeTileGrid, UIElement wideTileGrid, UIElement mediumTileGrid, UIElement smallTileGrid) { try { string largename = await SaveUIElementToFile(largeTileGrid, TileCategory.Large); string widename = await SaveUIElementToFile(wideTileGrid, TileCategory.Wide); string mediumname = await SaveUIElementToFile(mediumTileGrid, TileCategory.Medium); string smallname = await SaveUIElementToFile(smallTileGrid, TileCategory.Small); if (String.IsNullOrEmpty(widename) || String.IsNullOrEmpty(mediumname) || String.IsNullOrEmpty(smallname) || String.IsNullOrEmpty(largename)) { throw new NullReferenceException(); } //small var smallTileContent = TileContentFactory.CreateTileSquare71x71Image(); smallTileContent.Image.Src = "ms-appdata:///local/" + smallname; //medium var mediumTileContent = TileContentFactory.CreateTileSquare150x150Image(); mediumTileContent.RequireSquare71x71Content = true; mediumTileContent.Square71x71Content = smallTileContent; mediumTileContent.Image.Src = "ms-appdata:///local/" + mediumname; mediumTileContent.Branding = TileBranding.None; //wide var wideTileContent = TileContentFactory.CreateTileWide310x150Image(); wideTileContent.RequireSquare150x150Content = true; wideTileContent.Square150x150Content = mediumTileContent; wideTileContent.Image.Src = "ms-appdata:///local/" + widename; wideTileContent.Branding = TileBranding.None; var largeTileContent = TileContentFactory.CreateTileSquare310x310Image(); largeTileContent.RequireWide310x150Content = true; largeTileContent.Wide310x150Content = wideTileContent; largeTileContent.Image.Src = "ms-appdata:///local/" + largename; largeTileContent.Branding = TileBranding.None; var notification = largeTileContent.CreateNotification(); //TileUpdateManager.CreateTileUpdaterForApplication().Clear(); TileUpdateManager.CreateTileUpdaterForApplication().Update(notification); return(true); } catch (Exception) { return(false); } }
private static TileNotification CreateNotifiction(string largeImageName, string wideImageName, string mediumImageName, string smallImageName, string notificationTag, string captionText) { return(GetTileNotification ( GetLargeTile ( TileContentFactory.CreateTileSquare310x310ImageAndText01() ).CreateNotification() )); TileNotification GetTileNotification(TileNotification tileNotification) { tileNotification.Tag = notificationTag; return(tileNotification); } ITileSquare310x310ImageAndText01 GetLargeTile(ITileSquare310x310ImageAndText01 largeTile) { largeTile.TextCaptionWrap.Text = ResourceStringNames.notificationText01.GetResourceString(); largeTile.Image.Src = $"ms-appx:///Tiles/{largeImageName}.png"; largeTile.Wide310x150Content = GetWideTile(TileContentFactory.CreateTileWide310x150ImageAndText01()); return(largeTile); } ITileWide310x150ImageAndText01 GetWideTile(ITileWide310x150ImageAndText01 largeTile) { largeTile.TextCaptionWrap.Text = captionText; largeTile.Image.Src = $"ms-appx:///Tiles/{wideImageName}.png"; largeTile.Square150x150Content = GetMediumTile(TileContentFactory.CreateTileSquare150x150Image()); return(largeTile); } ITileSquare150x150Image GetMediumTile(ITileSquare150x150Image mediumTile) { mediumTile.Image.Src = $"ms-appx:///Tiles/{mediumImageName}.png"; mediumTile.Square71x71Content = GetSmallTile(TileContentFactory.CreateTileSquare71x71Image()); return(mediumTile); } ITileSquare71x71Image GetSmallTile(ITileSquare71x71Image smallTile) { smallTile.Image.Src = $"ms-appx:///Tiles/{smallImageName}.png"; return(smallTile); } }
/// <summary> /// 支持宽/中/小磁贴的更新 /// </summary> /// <param name="wideTileGrid"></param> /// <param name="mediumTileGrid"></param> /// <param name="smallTileGrid"></param> /// <returns></returns> public async static Task <bool> UpdatePersonalTile(UIElement wideTileGrid, UIElement mediumTileGrid, UIElement smallTileGrid, bool isAddToSchedule = false) { try { string widename = await SaveUIElementToFile(wideTileGrid, TileCategory.Wide); string mediumname = await SaveUIElementToFile(mediumTileGrid, TileCategory.Medium); string smallname = await SaveUIElementToFile(smallTileGrid, TileCategory.Small); if (string.IsNullOrEmpty(widename) || string.IsNullOrEmpty(mediumname) || string.IsNullOrEmpty(smallname)) { throw new NullReferenceException(); } //small var smallTileContent = TileContentFactory.CreateTileSquare71x71Image(); smallTileContent.Image.Src = "ms-appdata:///local/" + smallname; //medium var mediumTileContent = TileContentFactory.CreateTileSquare150x150Image(); mediumTileContent.RequireSquare71x71Content = true; mediumTileContent.Square71x71Content = smallTileContent; mediumTileContent.Image.Src = "ms-appdata:///local/" + mediumname; mediumTileContent.Branding = TileBranding.None; //wide var wideTileContent = TileContentFactory.CreateTileWide310x150Image(); wideTileContent.RequireSquare150x150Content = true; wideTileContent.Square150x150Content = mediumTileContent; wideTileContent.Image.Src = "ms-appdata:///local/" + widename; wideTileContent.Branding = TileBranding.None; TileUpdateManager.CreateTileUpdaterForApplication().EnableNotificationQueue(isAddToSchedule); var notification = wideTileContent.CreateNotification(); TileUpdateManager.CreateTileUpdaterForApplication().Update(notification); return(true); } catch (Exception) { return(false); } }
void SendScaledImageTileNotification_Click(object sender, RoutedEventArgs e) { string scale; ResourceContext.GetForCurrentView().QualifierValues.TryGetValue("Scale", out scale); ITileSquare310x310Image square310x310TileContent = TileContentFactory.CreateTileSquare310x310Image(); square310x310TileContent.Image.Src = "ms-appx:///images/purpleSquare310x310.png"; square310x310TileContent.Image.Alt = "Purple square"; ITileWide310x150ImageAndText01 wide310x150TileContent = TileContentFactory.CreateTileWide310x150ImageAndText01(); wide310x150TileContent.TextCaptionWrap.Text = "scaled version of blueWide310x150.png in the xml is selected based on the current Start scale"; wide310x150TileContent.Image.Src = "ms-appx:///images/blueWide310x150.png"; wide310x150TileContent.Image.Alt = "Blue wide"; ITileSquare150x150Image square150x150TileContent = TileContentFactory.CreateTileSquare150x150Image(); square150x150TileContent.Image.Src = "ms-appx:///images/graySquare150x150.png"; square150x150TileContent.Image.Alt = "Gray square"; ITileSquare71x71Image square71x71TileContent = TileContentFactory.CreateTileSquare71x71Image(); square71x71TileContent.Image.Src = "ms-appx:///images/graySquare150x150.png"; square71x71TileContent.Image.Alt = "Gray square"; square150x150TileContent.Square71x71Content = square71x71TileContent; wide310x150TileContent.Square150x150Content = square150x150TileContent; square310x310TileContent.Wide310x150Content = wide310x150TileContent; TileUpdateManager.CreateTileUpdaterForApplication().Update(square310x310TileContent.CreateNotification()); OutputTextBlock.Text = MainPage.PrettyPrint(square310x310TileContent.GetContent()); rootPage.NotifyUser("Tile notification with scaled images sent.", NotifyType.StatusMessage); }
void UpdateTile() { try { var imgs = ViewModel.RecommandSection.First(g => g.Key.Contains("更新")).Take(6).ToArray(); var tileContent = TileContentFactory.CreateTileSquare310x310ImageCollectionAndText01(); tileContent.AddImageQuery = true; tileContent.ImageMain.Src = imgs[0].CoverImageUri; tileContent.ImageMain.Alt = imgs[0].Title; tileContent.ImageSmall1.Src = imgs[1].CoverImageUri; tileContent.ImageSmall1.Alt = imgs[1].Title; tileContent.ImageSmall2.Src = imgs[2].CoverImageUri; tileContent.ImageSmall2.Alt = imgs[2].Title; tileContent.ImageSmall3.Src = imgs[3].CoverImageUri; tileContent.ImageSmall3.Alt = imgs[3].Title; tileContent.ImageSmall4.Src = imgs[4].CoverImageUri; tileContent.ImageSmall4.Alt = imgs[4].Title; tileContent.TextCaptionWrap.Text = imgs[0].Description; // Create a notification for the Wide310x150 tile using one of the available templates for the size. //var wide310x150Content = TileContentFactory.CreateTileWide310x150ImageAndText01(); //wide310x150Content.TextCaptionWrap.Text = "This tile notification uses web images"; //wide310x150Content.Image.Src = ImgUri; //wide310x150Content.Image.Alt = "Web image"; var wide310x150Content = TileContentFactory.CreateTileWide310x150PeekImageCollection05(); wide310x150Content.AddImageQuery = true; //wide310x150Content.Lang = "zh-Hans"; wide310x150Content.ImageMain.Src = imgs[0].CoverImageUri; wide310x150Content.ImageMain.Alt = imgs[0].Title; wide310x150Content.ImageSecondary.Src = imgs[0].CoverImageUri; wide310x150Content.ImageSecondary.Alt = imgs[0].Title; wide310x150Content.ImageSmallColumn1Row1.Src = imgs[1].CoverImageUri; wide310x150Content.ImageSmallColumn1Row1.Alt = imgs[1].Title; wide310x150Content.ImageSmallColumn1Row2.Src = imgs[2].CoverImageUri; wide310x150Content.ImageSmallColumn1Row2.Alt = imgs[2].Title; wide310x150Content.ImageSmallColumn2Row1.Src = imgs[3].CoverImageUri; wide310x150Content.ImageSmallColumn2Row1.Alt = imgs[3].Title; wide310x150Content.ImageSmallColumn2Row2.Src = imgs[4].CoverImageUri; wide310x150Content.ImageSmallColumn2Row2.Alt = imgs[4].Title; wide310x150Content.TextHeading.Text = imgs[0].Title; wide310x150Content.TextBodyWrap.Text = imgs[0].Description; // Create a notification for the Square150x150 tile using one of the available templates for the size. var square150x150Content = TileContentFactory.CreateTileSquare150x150PeekImageAndText02(); //square150x150Content.Lang = "zh-Hans"; square150x150Content.Image.Src = imgs[0].CoverImageUri; square150x150Content.Image.Alt = imgs[0].Title; square150x150Content.TextHeading.Text = imgs[0].Title; square150x150Content.TextBodyWrap.Text = imgs[0].Description; //var square150x150Content = TileContentFactory.CreateTileSquare150x150Image(); //square150x150Content.Image.Src = ImgUri; //square150x150Content.Image.Alt = "Web image"; var square71x71Content = TileContentFactory.CreateTileSquare71x71Image(); square71x71Content.Image.Src = imgs[0].CoverImageUri;; square71x71Content.Image.Alt = imgs[0].Title; // Attached the Square71x71 template to the Square150x150 template. square150x150Content.Square71x71Content = square71x71Content; // Attach the Square150x150 template to the Wide310x150 template. wide310x150Content.Square150x150Content = square150x150Content; // Attach the Wide310x150 template to the Square310x310 template. tileContent.Wide310x150Content = wide310x150Content; // Send the notification to the application’s tile. TileUpdateManager.CreateTileUpdaterForApplication().Update(tileContent.CreateNotification()); } catch (Exception exception) { Debug.WriteLine(exception.Message); } }
public static async void ShowliveTile() { try { string FileData = await FileManagement.ReadFile("MissingPeople.json"); string ResultJson = "[" + FileData.ToString() + "]"; List <MissingPerson> Mis = JsonData.MissingPeopleList("el", ResultJson, Category.Missing).OrderByDescending(x => x.DateMissing).ToList <MissingPerson>(); if (Mis.Count >= 5) { string SkippedItemsString = AppStorage.SkippedItems.Get(); String[] Skipped = SkippedItemsString.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); if (Skipped.Count() != 0) { foreach (var item in Skipped) { Int32 Intitem = Convert.ToInt32(item); var stuffToRemove = Mis.SingleOrDefault(s => s.ID == Intitem); if (stuffToRemove != null) { Mis.Remove(stuffToRemove); } } } // 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 a notification for the Square310x310 tile using one of the available templates for the size. ITileSquare310x310SmallImagesAndTextList05 tileContent = TileContentFactory.CreateTileSquare310x310SmallImagesAndTextList05(); tileContent.TextHeading.Text = "Eξαφανίσεις"; tileContent.Image1.Src = Mis[0].ImageSrc; tileContent.TextGroup1Field1.Text = Mis[0].FullName; tileContent.TextGroup1Field2.Text = Mis[0].Town; tileContent.Image2.Src = Mis[1].ImageSrc; tileContent.TextGroup2Field1.Text = Mis[1].FullName; tileContent.TextGroup2Field2.Text = Mis[1].Town; tileContent.Image3.Src = Mis[2].ImageSrc; tileContent.TextGroup3Field1.Text = Mis[2].FullName; tileContent.TextGroup3Field2.Text = Mis[2].Town; // Create a notification for the Wide310x150 tile using one of the available templates for the size. ITileWide310x150PeekImageCollection05 wide310x150Content = TileContentFactory.CreateTileWide310x150PeekImageCollection05(); wide310x150Content.ImageMain.Src = Mis[0].ImageSrc; wide310x150Content.ImageSecondary.Src = Mis[0].ImageSrc; wide310x150Content.ImageSmallColumn1Row1.Src = Mis[1].ImageSrc; wide310x150Content.ImageSmallColumn1Row2.Src = Mis[2].ImageSrc; wide310x150Content.ImageSmallColumn2Row1.Src = Mis[3].ImageSrc; wide310x150Content.ImageSmallColumn2Row2.Src = Mis[4].ImageSrc; wide310x150Content.TextHeading.Text = Mis[0].Date; wide310x150Content.TextBodyWrap.Text = Mis[0].FullName + " Εξαφανίστηκε από " + Mis[0].Town; // Create a notification for the Square150x150 tile using one of the available templates for the size. ITileSquare150x150PeekImageAndText04 square150x150Content = TileContentFactory.CreateTileSquare150x150PeekImageAndText04(); square150x150Content.Image.Src = Mis[0].ImageSrc; square150x150Content.TextBodyWrap.Text = Mis[0].FullName + Mis[0].Town; // Create a notification for the Square71x71 tile using one of the available templates for the size. ITileSquare71x71Image square71x71Content = TileContentFactory.CreateTileSquare71x71Image(); square71x71Content.Image.Src = "ms-appx:///Assets/Square70x70Logo.scale-100"; square71x71Content.Image.Alt = "Silver Alert"; // Attach the Square71x71 template to the Square150x150 template. square150x150Content.Square71x71Content = square71x71Content; // Attach the Square150x150 template to the Wide310x150 template. wide310x150Content.Square150x150Content = square150x150Content; // Attach the Wide310x150 to the Square310x310 template. tileContent.Wide310x150Content = wide310x150Content; // Send the notification to the application’s tile. TileUpdateManager.CreateTileUpdaterForApplication().Update(tileContent.CreateNotification()); } } catch (Exception) { } }
public static async Task <bool> UpdateNoteTileIfExists(Note note, bool transparentTile = false) { //must exists if (!SecondaryTile.Exists(note.ID)) { return(false); } //update background await UpdateNoteTileBackgroundColor(note, transparentTile); string contentWithoutTitle = note.GetContent(true, false, 150, 3); string contentWithTitle = note.GetContent(true, true, 200, 3); var tileSquare71Content = TileContentFactory.CreateTileSquare71x71Image(); tileSquare71Content.Image.Src = "ms-appx:///Assets/Tiles/Transparent/Square71x71Logo.png"; ITileNotificationContent biggerTile; ISquare150x150TileNotificationContent tileSquare150Content; if (note.Images != null && note.Images.Count > 0) { tileSquare150Content = TileContentFactory.CreateTileSquare150x150PeekImageAndText02(); var _tileSquare150Content = tileSquare150Content as ITileSquare150x150PeekImageAndText02; _tileSquare150Content.TextHeading.Text = note.Title; _tileSquare150Content.TextBodyWrap.Text = contentWithoutTitle; _tileSquare150Content.Image.Src = note.Images[0].URL; _tileSquare150Content.Square71x71Content = tileSquare71Content; _tileSquare150Content.Branding = NotificationsExtensions.TileContent.TileBranding.Logo; } else { tileSquare150Content = TileContentFactory.CreateTileSquare150x150Text02(); var _tileSquare150Content = tileSquare150Content as ITileSquare150x150Text02; _tileSquare150Content.TextHeading.Text = note.Title; _tileSquare150Content.TextBodyWrap.Text = contentWithoutTitle; _tileSquare150Content.Square71x71Content = tileSquare71Content; _tileSquare150Content.Branding = NotificationsExtensions.TileContent.TileBranding.Logo; } IWide310x150TileNotificationContent tileWide310x150Content; if (note.Images != null && note.Images.Count > 0) { tileWide310x150Content = TileContentFactory.CreateTileWide310x150PeekImage01(); var _tileWide310x150Content = tileWide310x150Content as ITileWide310x150PeekImage01; _tileWide310x150Content.TextHeading.Text = note.Title; _tileWide310x150Content.TextBodyWrap.Text = contentWithoutTitle; _tileWide310x150Content.Image.Src = note.Images[0].URL; _tileWide310x150Content.Square150x150Content = tileSquare150Content; _tileWide310x150Content.Branding = NotificationsExtensions.TileContent.TileBranding.Logo; } else { tileWide310x150Content = TileContentFactory.CreateTileWide310x150Text09(); var _tileWide310x150Content = tileWide310x150Content as ITileWide310x150Text09; _tileWide310x150Content.TextHeading.Text = note.Title; _tileWide310x150Content.TextBodyWrap.Text = contentWithoutTitle; _tileWide310x150Content.Square150x150Content = tileSquare150Content; _tileWide310x150Content.Branding = NotificationsExtensions.TileContent.TileBranding.Logo; } #if WINDOWS_PHONE_APP biggerTile = tileWide310x150Content; #else ISquare310x310TileNotificationContent tileSquare310Content; if (note.Images != null && note.Images.Count > 0) { tileSquare310Content = TileContentFactory.CreateTileSquare310x310ImageAndTextOverlay02(); var _tileSquare310Content = tileSquare310Content as ITileSquare310x310ImageAndTextOverlay02; _tileSquare310Content.TextHeadingWrap.Text = note.Title; _tileSquare310Content.TextBodyWrap.Text = contentWithoutTitle; _tileSquare310Content.Image.Src = note.Images[0].URL; _tileSquare310Content.Wide310x150Content = tileWide310x150Content; _tileSquare310Content.Branding = NotificationsExtensions.TileContent.TileBranding.Logo; } else { tileSquare310Content = TileContentFactory.CreateTileSquare310x310ImageAndTextOverlay02(); var _tileSquare310Content = tileSquare310Content as ITileSquare310x310ImageAndTextOverlay02; _tileSquare310Content.TextHeadingWrap.Text = note.Title; _tileSquare310Content.TextBodyWrap.Text = contentWithoutTitle; _tileSquare310Content.Image.Src = ""; _tileSquare310Content.Wide310x150Content = tileWide310x150Content; _tileSquare310Content.Branding = NotificationsExtensions.TileContent.TileBranding.Logo; } biggerTile = tileSquare310Content; #endif //create notification var notification = biggerTile.CreateNotification(); notification.Tag = note.ID.Substring(0, 16); //update var tileUpdater = TileUpdateManager.CreateTileUpdaterForSecondaryTile(note.ID); tileUpdater.Clear(); //tileUpdater.EnableNotificationQueue(false); //crashing on w10mobile tileUpdater.Update(notification); return(true); }