My notes on Real World Windows 8 by @john_k_waters #devsum13

By binding your view's DataContext to the Application's View Model, you can bind subsequent elements to more specific view models (members of the AVM).

Background tasks

Windows 8 RT only executes your app when it's in the foreground. However, you are able to do background processing through Background Tasks. To create one, you create a new Windows Runtime Component project. Pick your name carefully, as it'll turn into the namespace you latter will need to reference in your app. In your UI app, you add a reference to your Runtime Component, in which you simply implement IBackgroundTask.
Your background task can get invoked on a Timer, be configured to Play Audio and much more.
Finally, your background task needs to be registered through your UI app.

You can set timer intervals and system dependencies - such as only execute the task if we have internet connection. Digging deeper, we see that it supports the following triggers with the addition of conditions (see below):

Trigger name
Description
InternetAvailable
The Internet becomes available.
NetworkStateChange
A network change such as a change in cost or connectivity occurs.
OnlineIdConnectedStateChange 
Online ID associated with the account changes.
SmsReceived
A new SMS message is received by an installed mobile broadband device.
TimeZoneChange
The time zone changes on the device (for example, when the system adjusts the clock for daylight saving time). 


Conditions:
Condition name
Description
InternetAvailable
The Internet must be available.
InternetNotAvailable
The Internet must be unavailable.
SessionConnected
The session must be connected.
SessionDisconnected
The session must be disconnected.
UserNotPresent
The user must be away.
UserPresent
The user must be present. 

Pretty slick!


To debug, your solution configuration now supports starting your background task. A tip: If you don't want to fire up your background every time you press play, simply disable the automatic execution in the project's property sheet.

Comments

Popular posts from this blog

Auto Mapper and Record Types - will they blend?

Unit testing your Azure functions - part 2: Queues and Blobs

Testing WCF services with user credentials and binary endpoints