I have a textbox to get the user name from the user and am trying to retrieve his latest tweet from my application and its not working. When i try to get all the tweets of a user using a list box its working fine.
I tried this code:
private void button1_Click(object sender, RoutedEventArgs e)
{
WebClient twitter = new WebClient();
twitter.DownloadStringCompleted += new DownloadStringCompletedEventHandler(twitter_DownloadStringCompleted);
twitter.DownloadStringAsync(new Uri("http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=" + username.Text));
}
void twitter_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
//throw new NotImplementedException();
if (e.Error != null)
return;
XElement xmlTweets = XElement.Parse(e.Result);
//trying something
var message = from tweet in xmlTweets.Descendants("status")
select tweet.Element("text").Value;
textBlock1.Text = message.ToString();
}
the output : System.Linq.Enumerable+
Try this: