Skip to content

Instantly share code, notes, and snippets.

@nicwise
Created November 23, 2011 07:50
Show Gist options
  • Save nicwise/1388137 to your computer and use it in GitHub Desktop.
Save nicwise/1388137 to your computer and use it in GitHub Desktop.
tweetme!
var content = new StringBuilder();
content.AppendFormat("status={0}", OAuth.PercentEncode(tweetText));
var stringContent = content.ToString();
System.Net.ServicePointManager.Expect100Continue = false;
var client = new WebClient();
Uri uri = new Uri("http://twitter.com/statuses/update.json");
BeginInvokeOnMainThread(() => {Util.PushNetworkActive();});
LastTweetError = false;
OAuthAuthorizer.AuthorizeRequest(OAConfig, client, AccessToken, AccessTokenSecret, "POST", uri, stringContent);
try {
client.UploadData(uri, "POST", Encoding.UTF8.GetBytes(stringContent));
} catch (WebException ex){
LastTweetError = true;
LastTweetErrorException = ex;
} finally {
BeginInvokeOnMainThread(() => {Util.PopNetworkActive();});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment