Exemplo n.º 1
0
        public void UserStreamTest()
        {
            OAuthTokens tokens = Configuration.GetTokens();
            stream = new TwitterStream(tokens);
            stream.OnStatusReceived += new TwitterStatusReceivedHandler(stream_OnStatus);
            stream.OnFriendsReceived += new TwitterFriendsReceivedHandler(stream_OnFriendsReceived);
            stream.OnStatusDeleted +=new TwitterStatusDeletedHandler(stream_OnStatusDeleted);

            stream.StartUserStream();

            for (int i = 0; i < 1000; i++)
            {
                System.Threading.Thread.Sleep(100);
            }

            stream.EndStream();
        }
Exemplo n.º 2
0
        public void FilterTest()
        {
            OAuthTokens tokens = Configuration.GetTokens();

            stream = new TwitterStream(tokens);
            stream.OnStatusReceived += new TwitterStatusReceivedHandler(stream_OnStatus);

            FilterStreamOptions options = new FilterStreamOptions();
            options.Track.Add("twit_er_izer");
            options.Track.Add("twitterizer");
            
            stream.StartFilterStream(options);

            for (int i = 0; i < 1000; i++)
            {
                System.Threading.Thread.Sleep(100);    
            }
            
            stream.EndStream();
        }
        public void StartCaptureStreaming(SearchParameters parameters)
        {
            StreamOptions options = new StreamOptions();
            options.Track.Add(parameters.SearchKey);
            this._stopSearch = false;

            TwitterStream stream = new TwitterStream(tokens, "RTSearch (Dev)", options);

            IAsyncResult result = stream.StartPublicStream(
                StreamStopped,
                NewTweet,
                DeletedTweet,
                OtherEvent
            );

            while (!this._stopSearch)
            {

            }

            stream.EndStream(StopReasons.StoppedByRequest, "Stop by user");
        }
Exemplo n.º 4
0
        public static void startStream(StreamOptions options)
        {
            Console.BufferWidth = 100;
            Console.WindowWidth = 100;

            TwitterStream stream = new TwitterStream(
                tokens,
                "UofCResearch",
                options);

            Console.WriteLine("stream 1 is starting ...");
            stream.StartPublicStream(
                StreamStopped,
                NewTweet,
                DeletedTweet,
                OtherEvent,
                RawJson);

            Console.WriteLine("stream 1 has started. Press any key to stop.");
            Console.ReadKey();

            Console.WriteLine("Stopping the stream ...");
            stream.EndStream();
        }