Esempio n. 1
0
        public void Button1_Click(object sender, EventArgs e)
        {
            string Input  = TextBox1.Text;
            string method = Input.Split('(')[0];
            int    x      = Input.Length - 1 - (Input.IndexOf('(') + 1);
            string value  = Input.Substring(Input.IndexOf('(') + 1, x);

            UserTimelineOptions userOptions = new UserTimelineOptions();

            userOptions.APIBaseAddress = "https://api.twitter.com/1.1/";                                            // <-- needed for API 1.1
            userOptions.Count          = 5;
            userOptions.UseSSL         = true;                                                                      // <-- needed for API 1.1
            userOptions.ScreenName     = value;                                                                     //<-- replace with yours
            TwitterResponse <TwitterStatusCollection> timeline = TwitterTimeline.UserTimeline(tokens, userOptions); // collects first 20 tweets from our account
            int i = 1;
            //TwitterResponse<TwitterTrendCollection> timelineres = TwitterTrend.Trends(tokens,1);

            TwitterResponse <TwitterUser> followers = TwitterUser.Show(tokens, value);

            if (followers.Result == RequestResult.Success)
            {
                TextBox2.Text = "Number of followers for " + followers.ResponseObject.ScreenName + " is " + followers.ResponseObject.NumberOfFollowers + Environment.NewLine;
            }

            //if (showUserResponse.Result == RequestResult.Success)
            //    {
            //    string screenName = showUserResponse.ResponseObject.ScreenName;
            //    Response.Write(screenName);
            //    Response.Write("<br>");
            //    Response.Write(showUserResponse.ResponseObject.NumberOfFollowers);
            //    }
            //FollowersOptions options = new FollowersOptions();
            //options.ScreenName = value;
            //options.UserId = 212250358;
            //options.UseSSL = true;
            //TwitterResponse<TwitterUserCollection> Followernames = TwitterFriendship.Followers(tokens, options);
            //TwitterResponse<TwitterUserCollection> followers = TwitterFriendship.Followers(options);
            //foreach (var follower in followers.ResponseObject.)
            //{
            //    TextBox2.Text += i + ")" + follower + Environment.NewLine;
            //    i++;
            //}
            foreach (TwitterStatus status in timeline.ResponseObject)
            {
                TextBox2.Text += i + ")" + status.Text + Environment.NewLine;
                i++;
            }

            //Getting trends from a location
            LocalTrendsOptions trendoptions = new LocalTrendsOptions();

            trendoptions.UseSSL = true;


            //  TwitterResponse<TwitterTrendCollection> tr = TwitterTrend.Trends(1);
            //foreach (TwitterTrend tnds in tr.ResponseObject)
            //{
            //    TextBox2.Text += tnds.ToString() + Environment.NewLine;
            //}
        }
Esempio n. 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TrendsCommand"/> class.
 /// </summary>
 /// <param name="tokens">The request tokens.</param>
 /// <param name="WOEID">The WOEID.</param>
 /// <param name="options">The options.</param>
 public TrendsCommand(OAuthTokens tokens, int WOEID, LocalTrendsOptions options)
     : base(
         HTTPVerb.GET,
         string.Format(CultureInfo.InvariantCulture, "trends/{0}.json", WOEID),
         tokens,
         options)
 {
 }
Esempio n. 3
0
        /// <summary>
        /// Initializes the command.
        /// </summary>
        public override void Init()
        {
            LocalTrendsOptions options = this.OptionalProperties as LocalTrendsOptions;

            if (options == null)
            {
                return;
            }

            if (options.ExcludeHashTags)
            {
                this.RequestParameters.Add("exclude", "hashtags");
            }
        }