/// <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 }; }
public void Test_Tile_Xml_Special_People_ManyImages() { string payload = "<binding template='TileMedium' hint-presentation='people'>"; TileBindingContentPeople content = new TileBindingContentPeople(); // Add 30 images for (int i = 1; i <= 30; i++) { string src = i + ".jpg"; content.Images.Add(new TileImageSource(src)); payload += $"<image src='{src}'/>"; } payload += "</binding>"; AssertBindingMedium(payload, new TileBinding() { Content = content }); }
public void Test_Tile_Xml_Special_People_OneImage() { TileBindingContentPeople content = new TileBindingContentPeople() { Images = { new TileImageSource("http://msn.com/1.jpg") { AddImageQuery = true, Alt = "alternate" } } }; AssertBindingMedium("<binding template='TileMedium' hint-presentation='people'><image src='http://msn.com/1.jpg' addImageQuery='True' alt='alternate'/></binding>", new TileBinding() { Content = content }); }
public void Test_Tile_Xml_Special_People_TwoImages() { TileBindingContentPeople content = new TileBindingContentPeople() { Images = { new TileImageSource("Assets/1.jpg"), new TileImageSource("Assets/2.jpg") } }; AssertBindingMedium("<binding template='TileMedium' hint-presentation='people'><image src='Assets/1.jpg'/><image src='Assets/2.jpg'/></binding>", new TileBinding() { Content = content }); }
public void Test_Tile_Xml_Special_People_Defaults() { TileBindingContentPeople content = new TileBindingContentPeople(); AssertBindingMedium("<binding template='TileMedium' hint-presentation='people'/>", new TileBinding() { Content = content }); }