9. Labor segédanyagok
Források
Snippet 01. UpdateTile
private void UpdateTile(IList<RecipeGroup> recipeGroups)
{
var wideContent = TileContentFactory.CreateTileWide310x150PeekImageCollection03();
wideContent.ImageMain.Src = recipeGroups[0].Recipes[0].TileImage;
wideContent.ImageSmallColumn1Row1.Src = recipeGroups[0].Recipes[1].TileImage;
wideContent.ImageSmallColumn1Row2.Src = recipeGroups[0].Recipes[2].TileImage;
wideContent.ImageSmallColumn2Row1.Src = recipeGroups[0].Recipes[3].TileImage;
wideContent.ImageSmallColumn2Row2.Src = recipeGroups[0].Recipes[4].TileImage;
wideContent.TextHeadingWrap.Text = string.Format("The best {0} recipes...", recipeGroups[0].Title);
wideContent.Branding = TileBranding.Logo;
var squareContent = TileContentFactory.CreateTileSquare150x150PeekImageAndText04();
squareContent.TextBodyWrap.Text = wideContent.TextHeadingWrap.Text;
squareContent.Image.Src = recipeGroups[0].Recipes[1].TileImage;
squareContent.Branding = TileBranding.Logo;
wideContent.Square150x150Content = squareContent;
TileUpdateManager.CreateTileUpdaterForApplication().Update(wideContent.CreateNotification());
}
Snippet 02. TileRefreshBackgroundTask
public sealed class TileRefreshBackgroundTask : IBackgroundTask
{
public async void Run(IBackgroundTaskInstance taskInstance)
{
var deferral = taskInstance.GetDeferral();
var proxy = new CookbookProxy();
var recipe = await proxy.GetRandomRecipeAsync();
var tile = TileContentFactory.CreateTileWide310x150ImageAndText01();
tile.Image.Src = recipe.TileImage;
tile.TextCaptionWrap.Text = recipe.Title;
tile.Branding = TileBranding.Logo;
var ts = TileContentFactory.CreateTileSquare150x150Image();
ts.Image.Src = recipe.TileImage;
ts.Branding = TileBranding.Logo;
tile.Square150x150Content = ts;
TileUpdateManager.CreateTileUpdaterForApplication().Update(tile.CreateNotification());
deferral.Complete();
}
}