Quantcast
Channel: Tweetinvi a friendly Twitter C# library
Viewing all articles
Browse latest Browse all 4126

New Post: Beginner Questions on Stream in WinForm

$
0
0
Hello,

I'm completely new to this, so I'm curious if I can ask for help getting streams to work in a winform. For starters, I just want to try logging a stream, but I'd be satisfied with starting a stream without the winform hanging. Here's what I have:
         private void btnStartStream_Click(object sender, EventArgs e)
        {
            Console.WriteLine("** Start Stream has been clicked");
            
            var credentials = TwitterCredentials.CreateCredentials(accessToken, accessTokenSecret, myConsumerKey, myConsumerSecret);
            
            TwitterCredentials.ExecuteOperationWithCredentials(credentials, ()
                =>
            {
                var sampleStream = Stream.CreateSampleStream();
                sampleStream.TweetReceived += (s, a) => Console.WriteLine(a.Tweet.Text);
                sampleStream.StartStream();
            }); 

            Console.WriteLine("** Stream has been started");
        }
When I click my "Start Stream" button, this code launches. I never see "** Stream has been started" in the log. I can't get past sampleStream.StartStream(); using breakpoints. I'm sure I have a pretty basic misunderstanding of something here, but what could that possibly be?

Viewing all articles
Browse latest Browse all 4126

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>