Beispiel #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            var twitter = new Twitter
            {
                OAuthConsumerKey    = "G3fdEmo3a2rIHbzR70O7KQij0",
                OAuthConsumerSecret = "buFAGPjj4ingWBZmEMGYKnRsA0Y4jjQ5yZTXxQyn9obTHTnekq"
            };


            app.Run(async(context) =>
            {
                await context.Response.WriteAsync("<html><body>");
                IEnumerable <string> twittsClinton = twitter.GetTwitts("msignite", "", 10).Result;
                await context.Response.WriteAsync("<h2 style='color:blue;'>Recent 10 tweets mentions of  MS Ignite</h2>");
                foreach (var t in twittsClinton)
                {
                    await context.Response.WriteAsync(t + "<br/>");
                }
                IEnumerable <string> twittsTrump = twitter.GetTwitts("Azure", "", 10).Result;
                await context.Response.WriteAsync("<h2 style='color:green;'>Recent 10 tweets mentions of Azure</h2>");
                foreach (var t in twittsTrump)
                {
                    await context.Response.WriteAsync(t + "<br/>");
                }
                await context.Response.WriteAsync("</body></html>");
            });
        }
Beispiel #2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            var twitter = new Twitter
            {
                OAuthConsumerKey    = "G3fdEmo3a2rIHbzR70O7KQij0",
                OAuthConsumerSecret = "buFAGPjj4ingWBZmEMGYKnRsA0Y4jjQ5yZTXxQyn9obTHTnekq"
            };


            app.Run(async(context) =>
            {
                await context.Response.WriteAsync("<html><body style='background:url(https://github.com/shraddhaagrawal/scratch/blob/master/acs/TwitterApp/FlagBackground.jpg?raw=true)no-repeat;'>");
                IEnumerable <string> twittsClinton = twitter.GetTwitts("Hilary", "Clinton", 5).Result;
                IEnumerable <string> twittsTrump   = twitter.GetTwitts("Donald", "trump", 5).Result;
                await context.Response.WriteAsync("<h1 style='color:blue;'>Recent 5 tweets mentioned Hillary clinton</h1>");
                foreach (var t in twittsClinton)
                {
                    await context.Response.WriteAsync(t + "<br>");
                }
                await context.Response.WriteAsync("<h1 style='color:blue;'>Recent 5 tweets mentioned Donald trump</h1>");
                foreach (var t in twittsTrump)
                {
                    await context.Response.WriteAsync(t + "<br>");
                }
                await context.Response.WriteAsync("</body></html>");
            });
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            var twitter = new Twitter
            {
                OAuthCustomerKey    = "OAuth Customer Key",
                OAuthCustomerSecret = "OAuth Customer Secret"
            };
            IEnumerable <string> twitts = twitter.GetTwitts("", 100).Result;

            foreach (var t in twitts)
            {
                Console.WriteLine(t + "\n");
            }
            Console.ReadKey();
        }