private static void UpdateTile(List <string> faceFileNames) { var peopleTile9 = new TileBindingContentPeople(); var peopleTile15 = new TileBindingContentPeople(); var peopleTile20 = new TileBindingContentPeople(); foreach (var faceFileName in faceFileNames) { if (peopleTile9.Images.Count < 9) { peopleTile9.Images.Add(new TileBasicImage() { Source = $"ms-appdata:///local/{TILE_FOLDER_NAME}/{faceFileName}" }); } if (peopleTile15.Images.Count < 15) { peopleTile15.Images.Add(new TileBasicImage() { Source = $"ms-appdata:///local/{TILE_FOLDER_NAME}/{faceFileName}" }); } if (peopleTile20.Images.Count < 20) { peopleTile20.Images.Add(new TileBasicImage() { Source = $"ms-appdata:///local/{TILE_FOLDER_NAME}/{faceFileName}" }); } } TileContent content = new TileContent() { Visual = new TileVisual() { TileMedium = new TileBinding() { Content = peopleTile9 }, TileWide = new TileBinding() { Content = peopleTile15 }, TileLarge = new TileBinding() { Content = peopleTile20 } } }; TileNotification tileNotification = new TileNotification(content.GetXml()); TileUpdateManager.CreateTileUpdaterForApplication().Update(tileNotification); }
/// <summary> /// Generates a <see cref="TileBindingContentPeople"/> for a given list of image URLs. /// </summary> /// <param name="urls"> /// A <see cref="List{string}"/> containing the URLs to use for the tile images. May be app-relative or internet URLs. /// </param> /// <param name="maxCount">The maximum number of images to use for this particular binding size.</param> /// <returns></returns> private static TileBinding GetPeopleBinding(List <string> urls, int maxCount = 25) { var content = new TileBindingContentPeople(); foreach (var url in urls.Take(maxCount)) { content.Images.Add(new TileImageSource(url)); } return(new TileBinding() { Content = content }); }
/// <summary> /// Generate People tile binding /// </summary> /// <param name="countOfPhotos">The number of photos you want to have on the tile.</param> /// <returns></returns> private TileBinding GeneratePeopleBinding(int countOfPhotos) { // We only have 25 photos available to use if (countOfPhotos > 25) { countOfPhotos = 25; } // Create the People content var content = new TileBindingContentPeople(); // Add the photos for (int i = 1; i <= countOfPhotos; i++) { content.Images.Add(new TileImageSource($"Assets/ProfilePics/{i}.jpg")); } // And generate the binding, using the People content return(new TileBinding() { Content = content }); }