Created
November 23, 2011 07:50
-
-
Save nicwise/1388137 to your computer and use it in GitHub Desktop.
tweetme!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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