Example #1
0
        public static void Main(string[] args)
        {
            client = new TwitterClient(ConsumerKey, ConsumerSecret, AccessToken, AccessTokenSecret);


            client.OnRequestAuthenticationResponse += new TwitterClient.AuthenticationHandler(client_OnRequestAuthenticationResponse);

            if (!client.Authenticated)
            {
                client.Authenticate();
            }

            Properties.Settings.Default.AccessToken       = client.AccessToken;
            Properties.Settings.Default.AccessTokenSecret = client.AccessTokenSecret;
            Properties.Settings.Default.Save();

            queryString = client.Trends.ToArray()[0];

            Console.WriteLine("Starting monitoring of trend: " + queryString);
            network = new Network();

            //NetworkVisualizer visualizer = new NetworkVisualizer(network, new NETGen.Layout.FruchtermanReingold.FruchtermanReingoldLayout(10), new PresentationSettings(2000d, 1000d, 0d));

            //NetworkDisplay display = new NetworkDisplay(visualizer);

            counter = 0;
            stream  = client.CreateStatusFilter(client.Trends.ToArray()[0]);
            stream.OnNewJsonObject += new TwitterStream.NewJSONHandler(stream_OnNewJsonObject);
            stream.Start();

            Console.ReadKey();

            stream.Stop();
        }
Example #2
0
        public static void Main(string[] args)
        {
            client = new TwitterClient(ConsumerKey, ConsumerSecret, AccessToken, AccessTokenSecret);

            client.OnRequestAuthenticationResponse += new TwitterClient.AuthenticationHandler(client_OnRequestAuthenticationResponse);

            if (!client.Authenticated)
                client.Authenticate();

            Properties.Settings.Default.AccessToken = client.AccessToken;
            Properties.Settings.Default.AccessTokenSecret = client.AccessTokenSecret;
            Properties.Settings.Default.Save();

            queryString = client.Trends.ToArray()[0];

            Console.WriteLine("Starting monitoring of trend: "+queryString);
            network = new Network();

            //NetworkVisualizer visualizer = new NetworkVisualizer(network, new NETGen.Layout.FruchtermanReingold.FruchtermanReingoldLayout(10), new PresentationSettings(2000d, 1000d, 0d));

            //NetworkDisplay display = new NetworkDisplay(visualizer);

            counter = 0;
            stream = client.CreateStatusFilter(client.Trends.ToArray()[0]);
            stream.OnNewJsonObject += new TwitterStream.NewJSONHandler(stream_OnNewJsonObject);
            stream.Start();

            Console.ReadKey();

            stream.Stop();
        }
Example #3
0
        /// <summary>
        /// Creates a Twitter from the REST verb statuses/sample
        /// </summary>
        /// <returns>A TwitterStream object that can be used for sampling</returns>
        public TwitterStream CreateGardenHose()
        {
            TwitterStream stream = new TwitterStream(_credentials, "http://stream.twitter.com/1/statuses");

            stream.Request.Method = WebMethod.Get;
            stream.Request.Path   = "/sample.json?delimited=true";
            return(stream);
        }
Example #4
0
        /// <summary>
        /// Creates a TwitterStream that retrieves real-time result from the REST verb statuses/filter
        /// </summary>
        /// <param name="keywords"></param>
        /// <returns></returns>
        public TwitterStream CreateStatusFilter(params string[] keywords)
        {
            TwitterStream stream = new TwitterStream(_credentials, "http://stream.twitter.com/1/statuses");
            string        query  = "";

            foreach (string key in keywords)
            {
                query += key;
                if (key != keywords[keywords.Length - 1])
                {
                    query += ",";
                }
            }
            stream.Request.AddParameter("track", query);
            stream.Request.Path   = "filter.json";
            stream.Request.Method = WebMethod.Post;
            return(stream);
        }
Example #5
0
 /// <summary>
 /// Creates a TwitterStream that retrieves real-time result from the REST verb statuses/filter
 /// </summary>
 /// <param name="keywords"></param>
 /// <returns></returns>
 public TwitterStream CreateStatusFilter(params string[] keywords)
 {
     TwitterStream stream = new TwitterStream(_credentials, "http://stream.twitter.com/1/statuses");
     string query = "";
     foreach (string key in keywords)
     {
         query += key;
         if (key != keywords[keywords.Length - 1])
             query += ",";
     }
     stream.Request.AddParameter("track", query);
     stream.Request.Path = "filter.json";
     stream.Request.Method = WebMethod.Post;
     return stream;
 }
Example #6
0
 /// <summary>
 /// Creates a Twitter from the REST verb statuses/sample
 /// </summary>
 /// <returns>A TwitterStream object that can be used for sampling</returns>
 public TwitterStream CreateGardenHose()
 {
     TwitterStream stream = new TwitterStream(_credentials, "http://stream.twitter.com/1/statuses");
     stream.Request.Method = WebMethod.Get;
     stream.Request.Path = "/sample.json?delimited=true";
     return stream;
 }