void bw_Update(object sender, DoWorkEventArgs e) { oAuth = new oAuthTwitter(); oAuth.ConsumerKey = TwitterConfig.ConsumerKey; oAuth.ConsumerSecret = TwitterConfig.ConsumerSecret; oAuth.Token = TwitterConfig.Token; oAuth.TokenSecret = TwitterConfig.TokenSecret; string tweet = HttpUtility.UrlEncode(e.Argument.ToString()); if (!String.IsNullOrEmpty(TwitterConfig.PrefixTweet)) { tweet = TwitterConfig.PrefixTweet + " " + tweet; } if (tweet.Length > 140) { tweet = tweet.Substring(0, 140); } string oAuthReturn = oAuth.oAuthWebRequest( oAuthTwitter.Method.Post, "http://twitter.com/statuses/update.xml", "status=" + tweet ); //Console.WriteLine("Twitter test complete: " + oAuthReturn); }
private void btnStartAuthorization_Click(object sender, EventArgs e) { oAuth = new oAuthTwitter(); oAuth.ConsumerKey = this.ClassRegistry.Config.Twitter.ConsumerKey; oAuth.ConsumerSecret = this.ClassRegistry.Config.Twitter.ConsumerSecret; this.ClassRegistry.Config.Twitter.Pin = String.Empty; this.ClassRegistry.Config.Twitter.Token = String.Empty; this.ClassRegistry.Config.Twitter.TokenSecret = String.Empty; string oAuthLink = oAuth.AuthorizationLinkGet(); try { Process.Start(oAuthLink); tbTwitterPIN.Text = String.Empty; tbTwitterPIN.Enabled = true; lblTwitterPIN.Enabled = true; btnTwitterAuthorize.Enabled = true; } catch { tbTwitterPIN.Text = String.Empty; lblTwitterPIN.Enabled = false; tbTwitterPIN.Enabled = false; btnTwitterAuthorize.Enabled = false; MessageBox.Show("An error occurred trying to authenticate. Check your network settings and browser config, and try again.", "uTorrent Notifier - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
void bw_Update(object sender, DoWorkEventArgs e) { oAuth = new oAuthTwitter(); oAuth.ConsumerKey = TwitterConfig.ConsumerKey; oAuth.ConsumerSecret = TwitterConfig.ConsumerSecret; oAuth.Token = TwitterConfig.Token; oAuth.TokenSecret = TwitterConfig.TokenSecret; string tweet = HttpUtility.UrlEncode(e.Argument.ToString()); if (!String.IsNullOrEmpty(TwitterConfig.PrefixTweet)) { tweet = TwitterConfig.PrefixTweet + " " + tweet; } if (tweet.Length > 140) tweet = tweet.Substring(0, 140); string oAuthReturn = oAuth.oAuthWebRequest( oAuthTwitter.Method.Post, "http://twitter.com/statuses/update.xml", "status=" + tweet ); //Console.WriteLine("Twitter test complete: " + oAuthReturn); }
void bw_Update(object sender, DoWorkEventArgs e) { try { oAuth = new oAuthTwitter(); oAuth.ConsumerKey = TwitterConfig.ConsumerKey; oAuth.ConsumerSecret = TwitterConfig.ConsumerSecret; oAuth.Token = TwitterConfig.Token; oAuth.TokenSecret = TwitterConfig.TokenSecret; string tweet = HttpUtility.UrlEncode(e.Argument.ToString()); if (tweet.Length > 140) tweet = tweet.Substring(0, 140); string xml = oAuth.oAuthWebRequest( oAuthTwitter.Method.POST, "http://twitter.com/statuses/update.xml", "status=" + tweet ); } catch { } }
private void btnStartAuthorization_Click(object sender, EventArgs e) { oAuth = new oAuthTwitter(); oAuth.ConsumerKey = this.Config.Twitter.ConsumerKey; oAuth.ConsumerSecret = this.Config.Twitter.ConsumerSecret; this.Config.Twitter.PIN = String.Empty; this.Config.Twitter.Token = String.Empty; this.Config.Twitter.TokenSecret = String.Empty; string oAuthLink = oAuth.AuthorizationLinkGet(); try { Process.Start(oAuthLink); tbTwitterPIN.Text = String.Empty; tbTwitterPIN.Enabled = true; lblTwitterPIN.Enabled = true; btnTwitterAuthorize.Enabled = true; } catch { tbTwitterPIN.Text = String.Empty; lblTwitterPIN.Enabled = false; tbTwitterPIN.Enabled = false; btnTwitterAuthorize.Enabled = false; MessageBox.Show("An error occurred trying to authenticate. Check your network settings and browser config, and try again.", "uTorrent Notifier - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }