0
votes

I have a Windows Phone 7 application that currently uses Live Tile Schedules to update.

The new version of the app uses a background task to update the tiles.

However after upgrading the app on a phone, if a tile schedule is already running on the main tile it doesn't stop updating.

I need to stop the tile schedule if it is running.

Creating a new schedule and stopping it doesn't work:

var t = new ShellTileSchedule()
                {
                    MaxUpdateCount = 1,
                    Recurrence = UpdateRecurrence.Onetime,
                    StartTime = DateTime.Now,
                    RemoteImageUri = new Uri("http://mysite.com/livetile.png"),
                };
t.Start();
t.Stop();

Creating a new schedule on the main tile in Active Tiles doesn't work:

ShellTile mainTile = ShellTile.ActiveTiles.FirstOrDefault();
t = new ShellTileSchedule(mainTile)
                    {
                        MaxUpdateCount = 1,
                        Recurrence = UpdateRecurrence.Onetime,
                        StartTime = DateTime.Now,
                        RemoteImageUri = new Uri("http://mysite.com/livetile.png")
                     };
t.Start();
t.Stop();
2

2 Answers

2
votes

Since you can only have one ShellTileSchedule per application, creating a new one, starting it, and then stopping it, should remove the old one, and of course stop the one you just created.

(Why didn't you try before asking?)

1
votes

First of all, is this problem occurring in an app that is actually deployed to the marketplace? (by that I mean, is the update deployed?) If it isn't this might have to do with the way the actual deployment of developer apps to a phone works.

Here's some other suggestions, I haven't tested any of them: - Have you tried removing from your app? It's required for the ShellTileSchedule so removing it might stop it from working? This would probably happen automatically when submitting this app through the marketplace, but for testing you could give it a shot. - A ShellTileScheduel can be cancelled if it fails. If possible, could you try to remove the PNG file that's in the RemoteImageUri. Or fill it with broken data to mess the ShellTileSchedule up. I know this isn't pretty, but it might work. - Have you tried replacing the ShellTileSchedule with one that's not indefinitely recurring? Just make it execute (one last time) and then it finishes.

Good luck with it and please let us know if and how you fixed.