The main advantages of using the framework are immediately evident:
- If you start with one of Microsoft’s project templates (for example, Grid application) the Windows 7/8 look and feel has already been set up for you. This means you can be confident the application will respond smoothly to touch and will look good on a wide variety of screen sizes.
- The framework has clearly been influenced by knockouts binding feature so if you are familiar with this then you shouldn’t have too much trouble getting used to slightly different syntax:
Spot the difference!
<div data-win-bind="innerHTML: trafficImage"></div>
<div data-bind="html: trafficImage"></div>
Some small quirks that I have noticed.
The following line of code DID work:
trafficImage: '<img src="' + src + '" class="resize" />'
The following line of code did NOT work:
trafficImage: '<img src="' + src + '" class="resize"></img>'
At a guess, the framework doesn’t seem to appreciate strict xml structure when you write your html.
An Image Caching Issue…
I had trouble trying to stop the traffic images from being cached when I wanted to refresh the images. This might be a positive thing for another project but TFL defines rules for the public display of the traffic camera images.
One of these rules state:
‘Feeds must be grabbed and displayed with the same frequency as that in the <RefreshRate> tag.’
To avoid caching I tried the following possible solutions: (all to no avail)
- TFL doesn’t let you append a unique query string to the request URL.
- Attempted to access the DOM element and change it’s ID to a random number when a refresh is due.
- Destroying the contents of the element and rebuilding it also did not refresh those darn images.
- <META HTTP-EQUIV=”PRAGMA” CONTENT=”NO-CACHE”> This also didn’t help me.
Perhaps I am missing something very simple here. If any one knows a solution please leave a comment.
Next time, I will attempt to integrate these cameras into a map.
To get started with this development go to: http://msdn.microsoft.com/en-us/windows/apps/br229516