public void LoadTweets() { var f = new TwitterFetcher(); f.GetTweets(SearchKey, list => { DispatcherHelper.CheckBeginInvokeOnUI(() => { Tweets = new ObservableCollection<Tweet>(list); }); }); }
/// <summary> /// Agent that runs a scheduled task /// </summary> /// <param name="task"> /// The invoked task /// </param> /// <remarks> /// This method is called when a periodic or resource intensive task is invoked /// </remarks> protected override void OnInvoke(ScheduledTask task) { //TODO: Add code to perform your task in background var fetcher = new TwitterFetcher(); fetcher.GetTweets("#30tolaunch", (list) => { var tweet = list.FirstOrDefault(); if (tweet != null) { UpdateTile(tweet); } #if DEBUG_AGENT ScheduledActionService.LaunchForTest( "ScheduledAgent", TimeSpan.FromSeconds(30)); #endif NotifyComplete(); }); }