如何在 Windows Mobile 7.1 中检索特定用户的最新推文?
我有一个文本框来从用户那里获取用户名,并试图从我的应用程序中检索他的最新推文,但它不起作用。当我尝试使用列表框获取用户的所有推文时,它工作正常。 我尝试了这段代码:
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();
}
输出:System.Linq.Enumerable+
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+
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个:
Try this: