简体   繁体   中英

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.

Link 1

Link 2

But in this examples i can only login to the 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.

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.

Tweetinvi a friendly Twitter C# API

Have a look at this one too:

Windows Phone 8 - Twitter API

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..!! Thanks to all..!!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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