Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/281.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# WindowsPhone7中的Twitter集成_C#_Windows Phone 7 - Fatal编程技术网

C# WindowsPhone7中的Twitter集成

C# WindowsPhone7中的Twitter集成,c#,windows-phone-7,C#,Windows Phone 7,我想从twitter上获取用户信息,并在WindowsPhone7中显示。我找到了一些twitter集成的例子 但在这个例子中,我只能登录到twitter。我无法发布或获取用户信息。任何人都可以为WindowsPhone7Twitter集成提供示例应用程序或链接 登录后,我尝试如下操作: private void btntest_Click(object sender, RoutedEventArgs e) { string newURL = string.For

我想从twitter上获取用户信息,并在WindowsPhone7中显示。我找到了一些twitter集成的例子

但在这个例子中,我只能登录到twitter。我无法发布或获取用户信息。任何人都可以为WindowsPhone7Twitter集成提供示例应用程序或链接

登录后,我尝试如下操作:

 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;
    }
private void btntest\u单击(对象发送方,路由目标)
{
string newURL=string.Format(“https://api.twitter.com/1.1/users/show.json?screen_name={0}(用户名);
WebClient WebClient=新的WebClient();
webClient.DownloadStringCompleted+=新的DownloadStringCompletedEventHandler(webBrowser_已导航);
DownloadStringAsync(新Uri(newURL));
}
已导航无效webBrowser_(对象发送方,下载StringCompletedEventArgs e)
{
如果(例如错误!=null)
{
控制台写入线(“错误”);
返回;
}
Console.WriteLine(“Result==>”+e.Result);
//List tweets=JsonConvert.DeserializeObject(如Result);
//this.lbTweets.ItemsSource=tweets;
}
但在这里我无法获得用户信息。请帮我获取用户信息


提前感谢。

您是否尝试过使用
Codeplex
中的
Tweetinvi
API,在这里您可以获取用户详细信息,也可以发布推文

再看看这个:


我终于找到了解决办法。!!!:-)


现在我得到了用户的信息。。!!!5天的奋斗终于结束了。。!!谢谢大家

你好,库拉桑加。。我正在寻找WindowsPhone7。但似乎是WP8。这也是WP7的作品吗?@Vijay nop这是WP8的作品。那么,看看WP7的这些,好的。。我已经看到了这个链接。但是我的问题没有用。我也犯了同样的错误。但无法从该链接中提供的答案中解析。
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);
        });
    }