简单的推特应用

Igo*_*ros 1 twitter windows-phone-7

我试图用一种简单的方法将推文发布到推特上,仅此而已.我找不到一个体面的教程或与此相关的文档...它有10个库,无法弄清楚如何使用它们,甚至不想打扰它说实话我JUST WANNA POST ...这就是我的目标,但仍然无法正常工作:

    private void TweetBtn_Click(object sender, RoutedEventArgs e)
    {

        // Create a webclient with the twitter account credentials,which will be used to set the HTTP header or basic authentication
        client = new WebClient { Credentials = new NetworkCredential { UserName = usernameTxtBox.Text, Password = password.Password } };
        // Don't wait to receive a 100 Continue HTTP response from the server before sending out the message body
        //ServicePointManager.Expect100Continue = false;
        // Construct the message body
        byte[] messageBody = Encoding.UTF8.GetBytes("status=" + messageTxtBox.Text);
        // Send the HTTP headers and message body (a.k.a. Post the data)
        client.UploadStringCompleted += new UploadStringCompletedEventHandler(client_UploadStringCompleted);
        client.UploadStringAsync(new Uri("http://twitter.com/statuses/update.xml", UriKind.Absolute), messageTxtBox.Text);


    }
Run Code Online (Sandbox Code Playgroud)

提前致谢 :)

Ped*_*mas 5

如果你想要的只是向Twitter分享一条消息,为什么不使用ShareStatusTask呢?

您可以在这里查看有关如何使用它的示例代码!