Created
September 27, 2011 05:06
-
-
Save clausjoergensen/1244378 to your computer and use it in GitHub Desktop.
Gets the latest tweet, and draws it on a live tile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GetLatestTweet("Windcape") | |
.ContinueWith(task => | |
{ | |
var tcs = new TaskCompletionSource<bool>( | |
TaskCreationOptions.AttachedToParent); | |
if (task.IsCompleted) | |
{ | |
if (task.Result.Count > 0) | |
{ | |
// The TaskCompletionSource is being set to complete | |
// once all rendering is complete. | |
Deployment.Current.Dispatcher.BeginInvoke( | |
() => GenerateTile(task.Result[0], tcs)); | |
} | |
} | |
return tcs.Task; | |
}) | |
.ContinueWith(task => | |
{ | |
NotifyComplete(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment