Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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
            {
            }
        }