简体   繁体   English

Windows Phone 8 - Twitter API

[英]Windows Phone 8 - Twitter API

I am doing some research and can't seem to find a definitive way to query Twitter's API to get a user's tweets on WP8 using C#. 我正在做一些研究,似乎无法找到一种确定的方法来查询Twitter的API,以便使用C#获取用户在WP8上的推文。

The twitter user isn't my own account and all I want to do is retrieve tweets and not post any tweets. Twitter用户不是我自己的帐户,我想要做的就是检索推文而不发布任何推文。

Do I therefore need to Authenticate myself/my app? 因此,我需要验证自己/我的应用程序吗? Is the TweetSharp library appropriate for my objective? TweetSharp库是否适合我的目标?

I used the following example http://code.msdn.microsoft.com/wpapps/Twitter-Sample-using-f36bab75 : 我使用了以下示例http://code.msdn.microsoft.com/wpapps/Twitter-Sample-using-f36bab75

if (NetworkInterface.GetIsNetworkAvailable())
{
    //Obtain keys by registering your app on https://dev.twitter.com/apps
    var service = new TwitterService("abc", "abc");
    service.AuthenticateWith("abc", "abc");

    //ScreenName is the profile name of the twitter user.
    service.ListTweetsOnUserTimeline(new ListTweetsOnUserTimelineOptions() { ScreenName = "the_appfactory" }, (ts, rep) =>
    {
        if (rep.StatusCode == HttpStatusCode.OK)
        {
            //bind
            this.Dispatcher.BeginInvoke(() => { tweetList.ItemsSource = ts; });
        }
    });
}
else
{

    MessageBox.Show("Please check your internet connestion.");
}

I created a new application user the twitter dev website: https://dev.twitter.com/user/login?destination=home . 我在twitter dev网站上创建了一个新的应用程序用户: https//dev.twitter.com/user/login?destination = home Once this was set-up, I essentially copied and pasted the keys within the AuthenticateWith and TwitterService methods. 设置完成后,我基本上复制并粘贴了AuthenticateWithTwitterService方法中的密钥。

I haven't solved exactly how I shall display the data but, at runtime, I can see data being passed in. 我还没有完全解决我将如何显示数据,但在运行时,我可以看到传入的数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM