示例#1
0
        static void Main(string[] args)
        {
            const string query      = "http://search.twitter.com/search.json?q=mvc3";
            WebRequest   webRequest = WebRequest.Create(query);

            webRequest.Method      = "GET";
            webRequest.ContentType = "application/json";

            using (var response = webRequest.GetResponse())
            {
                using (var stream = response.GetResponseStream())
                {
                    var     contentReader = new StreamReader(stream);
                    var     content       = contentReader.ReadToEnd();
                    dynamic dtweets       = JsonParser.JsonParser.Deserialize(content);

                    foreach (var tweet in dtweets.results)
                    {
                        Console.WriteLine("Creado:{0}", tweet["created_at"]);
                        Console.WriteLine("From:{0}", tweet["from_user"]);
                        Console.WriteLine("Texto:{0}", tweet["text"]);
                        Console.WriteLine("***********************************************************");
                    }
                }
            }


            /*DEPOIS DO REFACTORING*/
            var parser = new TwitterXmlParser();
            var tweets = new TwitterSearchF(parser)
                         .Query("mvc3")
                         .Rpp(20)
                         .Search();

            var render = new RenderTweet(tweets);

            render.Write(Console.Out);

            Console.ReadLine();
        }
示例#2
0
        static void Main(string[] args)
        {
            const string query = "http://search.twitter.com/search.json?q=mvc3";
            WebRequest webRequest = WebRequest.Create(query);
            webRequest.Method = "GET";
            webRequest.ContentType = "application/json";

            using (var response = webRequest.GetResponse())
            {
                using (var stream = response.GetResponseStream())
                {
                    var contentReader = new StreamReader(stream);
                    var content = contentReader.ReadToEnd();
                    dynamic dtweets = JsonParser.JsonParser.Deserialize(content);

                    foreach (var tweet in dtweets.results)
                    {
                        Console.WriteLine("Creado:{0}", tweet["created_at"]);
                        Console.WriteLine("From:{0}", tweet["from_user"]);
                        Console.WriteLine("Texto:{0}", tweet["text"]);
                        Console.WriteLine("***********************************************************");
                    }
                }
            }

            /*DEPOIS DO REFACTORING*/
            var parser = new TwitterXmlParser();
            var tweets = new TwitterSearchF(parser)
                .Query("mvc3")
                .Rpp(20)
                .Search();

            var render = new RenderTweet(tweets);
            render.Write(Console.Out);

            Console.ReadLine();
        }
示例#3
0
 public TwitterSearchF(TwitterXmlParser parser)
 {
     _parser = parser;
 }
示例#4
0
 public TwitterSearchF(TwitterXmlParser parser)
 {
     _parser = parser;
 }