|
In my prevous articles I talked about how to Update Primary Tile and Schedule Tile Update in Windows Phone. Schedule tile update doesn't have option to schedule for a secondary tile update. The background image of the front of the Tile can be updated only after scheduled time in Windows Phone.
Let's see how we can use Update Primary Tile and Schedule Tile Update in conjunction to update secondary tile also.
Step 1: Create a image of size 173X173 like below.

Step 2: Create a folder images and place both the image in that folder. Once you add the image in the folder change the Build Action of the image from Resource to Content.

Step 3: Add Microsoft.Phone.Shell using directive.
using Microsoft.Phone.Shell;
Step 4: Place below code in the constructor of MainPage.xaml.cs. First we create normal ShellTile and then we pass it to the Constructor of ShellTileSchedule (marked in bold).
ShellTile PrimaryTile = ShellTile.ActiveTiles.First(); if (PrimaryTile != null) { StandardTileData tile = new StandardTileData(); tile.BackBackgroundImage = new Uri("images/Maroon.jpg", UriKind.Relative); tile.BackTitle = "Weather"; tile.BackContent = DateTime.Now.ToShortTimeString(); PrimaryTile.Update(tile);
ShellTileSchedule mySchedule = new ShellTileSchedule(PrimaryTile); mySchedule.StartTime = DateTime.Now; mySchedule.Interval = UpdateInterval.EveryHour; mySchedule.Recurrence = UpdateRecurrence.Interval; mySchedule.RemoteImageUri = new Uri(@"http://www.weather.gov/forecasts/graphical/images/conus/MaxT1_conus.png"); mySchedule.Start(); }
Step 5: Now run the application and pin it on start screen.
You will notice that secondary tile will start working immediately but primary tile which is set by RemoteImageUri property of ShellTileSchedule will take some time to update. It might take an hour to update.
This ends the article of scheduling secondary tile update in Windows Phone.
|