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
Hi,

This is normal, the StartStream method is a synchronous method that will exit only when the stream closes.
I believe you want your application to be running the stream in a BackgroundWorker or a new Thread instead of using the MainThread of your application.
var t = new Thread(() =>
{
    var sampleStream = Stream.CreateSampleStream();
    sampleStream.TweetReceived += (s, a) => Console.WriteLine(a.Tweet.Text);
    sampleStream.StreamStarted += (s, a) => Console.WriteLine("Stream started!");
    sampleStream.StartStream();
});

t.Start();
You can also notice that there is an event named StreamStarted to let you know when a Stream has successfully started to listen to Twitter Stream API.

Linvi

Viewing all articles
Browse latest Browse all 4126

Trending Articles



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