1

I am using live tiles for my application. The XML used to update the tile is dynamically generated and sometimes the update fails because of the content (I don't control what is being displayed in the live tile, I get that from webservices).

I used to use the API to build the notification through instances of TileWideSmallImageAndText02 for example but I now need to build the XML directly in the code. A simplified version of my code:

string tileXml = "<tile><visual><binding template=\"TileWideSmallImageAndText02\">" +
                                 "<image id=\"1\" src=\"" + image + "\" alt=\"alt text\"/>"
                                 + "<text id=\"1\">" + title + "</text>"
                                + "<text id=\"2\">" + date + "</text>"
                                 + "<text id=\"3\">" + time + "</text>"
                                + "<text id=\"4\">" + length + "</text>"
                             + "</binding>"
                             + "</visual>"
                            + "</tile>";
Windows.Data.Xml.Dom.XmlDocument tileDOM = 
                                    new Windows.Data.Xml.Dom.XmlDocument();
tileDOM.LoadXml(tileXml);
TileNotification tile = new TileNotification(tileDOM);
TileUpdateManager.CreateTileUpdaterForApplication().Update(tile);

Now as I said before, the notification may fail ; and by failing I mean the tile is not being updated. It looks like that if I send whatever XML content I want to the Update, no exception will be raised and I will never know if the live tile worked or not.

What would be a good way to intercept the failure if I receive badly formatted data from the webservices I use?

Max
  • 3,453
  • 3
  • 32
  • 50

1 Answers1

0

As far as I can tell there isn't a way to check whether an update failed.

You can protect yourself to some extent by using a library (PushSharp maybe) or sanitizing the data you retrieve from your webservices before you pass it on to the Notification service.

David Hayes
  • 7,402
  • 14
  • 50
  • 62