Question

Can you suggest tutorial which describes how to automatically update Windows phone 7 application tile every day? I need to take some local text from binding and put into the tile. I have done research on this. Some articles contains information about updating tile from server, some topics contains only parts not full source code or hard to understand.

Was it helpful?

Solution

You'll need to use a Periodic Task Agent.

Check the last time it was run. If that time was on a different day, then update the tile as needed.

Something like:

protected override void OnInvoke(ScheduledTask task)
{
    if (task.LastScheduledTime.Date != DateTime.Now.Date)
    {
        var tile = ShellTile.ActiveTiles.FirstOrDefault(t => t.NavigationUri.ToString().Contains("SOMETHING TO IDENTIFY THE TILE IN QUESTION"));

        if (tile != null)
        {
            var updatedTile = new StandardTileData
            {
                 Title = "WHATEVER",
                 BackContent = "SOME LOCAL DATA"
            };

            tile.Update(updatedTile);
        }
    }

    NotifyComplete();
}

For a starter on Background Tasks, see http://msdn.microsoft.com/en-us/library/hh202961(v=VS.92).aspx or for an example on creating one see http://msdn.microsoft.com/en-us/library/hh202941(v=vs.92).aspx

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top