public static TwitterStream Create(string consumerKey, string consumerSecret, string tokenValue, string tokenSecret) { var accessToken = new AccessToken(tokenValue, tokenSecret); var twitterStream = new TwitterStream(consumerKey, consumerSecret, accessToken); Parameter[] parameters = { }; twitterStream.webReponse = twitterStream.AccessProtectedResource(API_TWITTER_STREAMING, "GET", API_TWITTER_AUTHORIZE, parameters, null); return(twitterStream); }
public static void CreateAsync(string consumerKey, string consumerSecret, string tokenValue, string tokenSecret, CreateCompletedHandler onComplete) { var accessToken = new AccessToken(tokenValue, tokenSecret); var twitterStream = new TwitterStream(consumerKey, consumerSecret, accessToken); Parameter[] parameters = { }; HttpWebRequest request = null; var asyncResult = twitterStream.consumer.BeginAccessProtectedResource(twitterStream.accessToken, API_TWITTER_STREAMING, "GET", API_TWITTER_AUTHORIZE, parameters, null, out request, ar => { var asyncResult2 = request.BeginGetResponse(ar2 => { WebResponse result = null; result = request.EndGetResponse(ar2); twitterStream.webReponse = result; onComplete(twitterStream); }, null); }, null); }