While experimenting with push notifications for updating your live tiles, I found the ShellTileSchedule-class. It sounded interesting enough to play around with it.
On MSDN I found following description for this class : Creates an object which allows an application to schedule updates of its tile's background image. The ShellTileSchedule has some properties like the recurrence and the interval. The interval is an enumeration which goes from hourly to monthly :
Another Property is the RemoteImageUri. Because of the word "Remote" I assume that the image has to be remote (that was a hard one ). So for testing this thing I first set up a website, with simply a png-image (62*62 – I copied Background.png and changed it a bit with Paint). Let's set up our schedule. This has to be done in the Application_Launching:
private void Application_Launching(object sender, LaunchingEventArgs e)
{
sts = new ShellTileSchedule();
sts.Interval = UpdateInterval.
sts.Recurrence = UpdateRecurrence.Interval;
sts.RemoteImageUri = new Uri(String.Format("http://localhost:51177/Site/Tiles/1.png", TileNr.ToString()));
sts.Start();
}
After starting the application I had to wait for an hour before my tile changed. Changing the clock settings didn't do the job either, but after an hour, finally the tile changed.
This could be useful for pulling tiles, instead of pushing. Get a tile every hour for showing the weather conditions in your area.
Now about this "Remote"-thing. Can I use a local png-file for changing the tile this way ? My first try was to add a png-file, and than refer to it this way:
sts.RemoteImageUri = new Uri("/LocalTile/5.png",UriKind.Relative);
That was not good.
Also tried it with "/TilesTest;component/LocalTile/5.png", but also no success. I needed to get the absolute path. In Silverlight I can use App.Current.Host.Source and Windows Phone is Silverlight, right. But I cannot use the Source-property here, although I can see it in my Locals-window:
OK, another try : let's use this code:
Uri uri = new Uri(new Uri(
"file:///Applications//Install//27F6C4CB-1192-44AD-A970-635F12689A08//Install"),
"//LocalTile//5.png");
sts.RemoteImageUri = uri;
OK, I know it's not very useful, because every user that has this application, will also have another GUID. Still : I do it for serving science . Result :
What happened to my GUID and stuff jQuery152010964315148992043_1315308924440 Last try, Let's simplify by using this :
Uri uri = new Uri(
"file:///Applications//Install//27F6C4CB-1192-44AD-A970-635F12689A08//Install//LocalTile//5.png");
And now I get this :
OK, I quit. Remote indeed means Remote.