Simple Tiling

The default live tile for our application is rather unappealing. Surely there’s something better we can do with our 150x150px than that :) At the very least, we want to fix the title and display the current generation. Maybe some more ideas will come to us while we’re implementing them.

To get started, double-click Package.appxmanifest in the Solution Explorer and update the app display name and description. For tiles, I’ve updated the logo PNGs to be a screenshot of our cellmap at some random point in time and set the background to be a totally arbirtrary color (#38864D). For the splashscreen we now have an obviously developer-designed image and a matching background color of #FFFFFF. So far, so good.

Next, grab NotificationExtensions, build it, and add a local reference to your project (I put it into a 3rdparty folder). Honestly, I’m not sure why this wasn’t built into the framework. Also, there are (currently) some quirks in that project between the Debug and Release versions; they won’t affect us for now so I’m referencing the Debug winmd file. Add the following lines to timer_Tick

var tileContent = TileContentFactory.CreateTileSquareText03(); 

tileContent.TextBody1.Text =  string.Format("Generation: {0}", viewModel.Generation); 
tileContent.TextBody2.Text = string.Format("% Alive: {0}", cellMap.PercentageOfAliveCells); 

var tileNotification = tileContent.CreateNotification(); 


and these to CellMap to handle the new PercentageOfAliveCells property

private int numberOfAliveCells; 

// At the end of SetCell 

// At the end of ClearCell 

public int PercentageOfAliveCells 
    return (int)(numberOfAliveCells * 100 / width / height); 


Now when we run the app, we get something not-quite-as-hideous!

(Code so far)

comments powered by Disqus