I'm working on adding a live tile to my PAX app, to show the next item in the schedule. Finally got 'a' live tile working, with a couple headaches along the way.
1. Because I still have a 7.0 project, the nice simple API for 'ActiveTiles.FirstOrDefault' doesn't exist, so you have to use an Enumerator on the ActiveTiles set, and apparently I am still hazy on Enumerators so forgot to get next before trying to use the current tile.
2. I'm really making life more difficult for myself by continuing to target 7.0 devices, but I don't want to give up on them yet. But I do really want to offer a wide tile option to those who can use it! Fortunately Telerik offers a LiveTileHelper in their tools (which I already use and pay for) which handles the 'does this device support x' aspect of it, I haven't incorporated that yet but will definitely use it. I should probably read through all their docs to see what else there is, because I only found out about this by someone mentioning it in a stack overflow response about tiles.
3. Because I want the front of the tile to display a bunch of text, I'm going to have to generate a bitmap containing that text. I found a few examples on stack overflow , but somehow when I ran my app the generated image was not applied. I checked the tile docs and they mentioned that setting the BackgroundImage property to a null Uri would just be ignored, but I used the Isolated Storage Explorer to verify that the image was created and in the file system exactly where I expected. After going back to doublecheck anything I'd missed in the sample code, I noticed that their code looked like
BackgroundImage = new Uri("isostore:/Shared/ShellContent/Image.jpg", UriKind.Absolute),
whereas I had
data.BackgroundImage = new Uri("/Images/Tiles/paxTile.png", UriKind.Relative);
data.BackBackgroundImage = new Uri("/Images/Melbourne/melbTile.png", UriKind.Relative);
curiously enough the background image worked, but not the front image. I changed the front image to be in the format isostore:file, Absolute, and it worked! Still not sure why the requirements are different for the front and back - I left a comment on one of the MSDN pages for setting Live Tiles asking about this (and for a note to be added to the docs somewhere).Now I just have to design the tile layout and actually make it look decent. Here's the plan so far:
// __________________
// (x) // <- if you have more than one session on your schedule for the
// // next hour, this is how many. The tile just shows details on one.
// my great session... // max 14 chars? check font size
// rest of name?
// time // in users culture
//
// __PAX Digital Assistant__
// BACK
//______________________
//
// My session name is...
// 12:30: Unicorn
// Come play with my f...
// 12.30: Cat.
// Leave Me Alone Wit...
// 13:00: Main Theater
// _______________________
// layout wide:
//__________________________________________
//
// My session name is the funniest thing you eve...
// 12:30: Unicorn
// Come play with my friends while I make fun of y...
// 12.30: Cat.
// Leave Me Alone With My Collection of Pokemon...
// 13:00: Main Theater
//__________________________________________
No comments:
Post a Comment