[英]Twitter Integration In windows Phone 7
I want to get the user information from the twitter and show in windows phone 7. I found some examples for twitter integration. 我想从Twitter获取用户信息并在Windows Phone 7中显示。我找到了一些Twitter集成示例。
But in this examples i can only login to the twitter. 但是在此示例中,我只能登录到Twitter。 I can not post or can not get the user information.
我无法发布或无法获取用户信息。 Can any one provide a sample application or links for windows phone 7 twitter integration.
任何人都可以为Windows Phone 7 Twitter集成提供示例应用程序或链接。
After getting login i try like this: 登录后,我尝试这样:
private void btntest_Click(object sender, RoutedEventArgs e)
{
string newURL = string.Format("https://api.twitter.com/1.1/users/show.json?screen_name={0}", userScreenName);
WebClient webClient = new WebClient();
webClient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(webBrowser_Navigated);
webClient.DownloadStringAsync(new Uri(newURL));
}
void webBrowser_Navigated(object sender, DownloadStringCompletedEventArgs e)
{
if (e.Error != null)
{
Console.WriteLine("Error ");
return;
}
Console.WriteLine("Result==> " + e.Result);
//List<Tweet> tweets = JsonConvert.DeserializeObject<List<Tweet>>(e.Result);
//this.lbTweets.ItemsSource = tweets;
}
But here i can not get the user information. 但是在这里我无法获得用户信息。 Please help me to get the user infoemation.
请帮助我获取用户信息。
Thanks in advance. 提前致谢。
Did you try using the Tweetinvi
API from Codeplex
, where you could grab the user details as well you could post tweets. 您是否尝试过使用
Codeplex
的Tweetinvi
API,在这里您可以获取用户详细信息,也可以发布推文。
Tweetinvi a friendly Twitter C# API Tweetinvi一个友好的Twitter C#API
Have a look at this one too: 也看一下这个:
Finally i found the Solution..!!! 终于我找到了解决方案.. !!! :-)
:-)
public void GetTwitterDetail(string _userScreenName)
{
var credentials = new OAuthCredentials
{
Type = OAuthType.ProtectedResource,
SignatureMethod = OAuthSignatureMethod.HmacSha1,
ParameterHandling = OAuthParameterHandling.HttpAuthorizationHeader,
ConsumerKey = AppSettings.consumerKey,
ConsumerSecret = AppSettings.consumerKeySecret,
Token = this.accessToken,
TokenSecret = this.accessTokenSecret,
};
var restClient = new RestClient
{
Authority = "https://api.twitter.com/1.1",
HasElevatedPermissions = true
};
var restRequest = new RestRequest
{
Credentials = credentials,
Path = string.Format("/users/show.json?screen_name={0}&include_entities=true", _userScreenName),
Method = WebMethod.Get
};
restClient.BeginRequest(restRequest, new RestCallback(test));
}
private void test(RestRequest request, RestResponse response, object obj)
{
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
Console.WriteLine("Content==> " + response.Content.ToString());
Console.WriteLine("StatusCode==> " + response.StatusCode);
});
}
Now i got the User's In formations..!!! 现在我得到了用户的信息.. !!! 5 days struggling comes to end..!!
5天的奋斗结束了.. !! Thanks to all..!!
谢谢大家..!!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.