2013-12-16 58 views
0

我做了一些研究,似乎無法找到一個明確的方法來查詢Twitter的API使用C#來獲得WP8用戶的鳴叫。的Windows Phone 8 - Twitter的API

twitter用戶不是我自己的帳戶,我想要做的就是檢索推文,不是發佈任何推文。

不要因此,我需要驗證自己/我的應用程序? TweetSharp庫適合我的目標嗎?

回答

2

我用下面的例子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."); 
} 

我創建了一個新的應用程序用戶的Twitter開發網站:https://dev.twitter.com/user/login?destination=home。一旦設置完成,我基本上覆制並粘貼了AuthenticateWithTwitterService方法中的密鑰。

我還沒有完全解決如何顯示數據,但在運行時我可以看到數據被傳入。