Skip to content

Instantly share code, notes, and snippets.

@clausjoergensen
Created September 27, 2011 05:06
Show Gist options
  • Save clausjoergensen/1244378 to your computer and use it in GitHub Desktop.
Save clausjoergensen/1244378 to your computer and use it in GitHub Desktop.
Gets the latest tweet, and draws it on a live tile
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