public void InsertDM(FlowLayoutPanel panel, TwitterDirectMessage dm)
        {
            this.Invoke(new Action(delegate
              {
            // insert new DM in list
            TweetControl tc = new TweetControl();
            Global.DownloadImageToPictureBox(tc.picAvatar, dm.Sender.ProfileImageSecureLocation, this);
            tc.labelFollowers.Text = dm.Sender.NumberOfFollowers.Value.ToString();
            tc.labelName.Text = dm.Sender.ScreenName;
            tc.labelDate.Text = FormatDate(dm.CreatedDate);
            tc.labelVia.Text = "via Direct Message";
            tc.labelInReplyTo.Text = "";
            //tc.labelText.Text = dm.Text;
            tc.rtText.Text = dm.Text;
            FindAlternativeLinks(tc.rtText);
            tc.Width = panel.Width - 8 - panel.Padding.Right;
            tc.DM = dm;
            panel.Controls.Add(tc);
            panel.Controls.SetChildIndex(tc, 0);

            // limit amount of tweets in list
            if (panel.Controls.Count > 100) {
              // delete anything after 100
              for (int i = 101; i < panel.Controls.Count; i++) {
            panel.Controls.RemoveAt(101); // index should always be 101... o___o
            // this loop looks weird.
              }
            }
              }));
        }
        public void InsertDM(FlowLayoutPanel panel, TwitterDirectMessage dm)
        {
            this.Invoke(new Action(delegate
            {
                // insert new DM in list
                TweetControl tc = new TweetControl();
                Global.DownloadImageToPictureBox(tc.picAvatar, dm.Sender.ProfileImageSecureLocation, this);
                tc.labelFollowers.Text = dm.Sender.NumberOfFollowers.Value.ToString();
                tc.labelName.Text      = dm.Sender.ScreenName;
                tc.labelDate.Text      = FormatDate(dm.CreatedDate);
                tc.labelVia.Text       = "via Direct Message";
                tc.labelInReplyTo.Text = "";
                //tc.labelText.Text = dm.Text;
                tc.rtText.Text = dm.Text;
                FindAlternativeLinks(tc.rtText);
                tc.Width = panel.Width - 8 - panel.Padding.Right;
                tc.DM    = dm;
                panel.Controls.Add(tc);
                panel.Controls.SetChildIndex(tc, 0);

                // limit amount of tweets in list
                if (panel.Controls.Count > 100)
                {
                    // delete anything after 100
                    for (int i = 101; i < panel.Controls.Count; i++)
                    {
                        panel.Controls.RemoveAt(101); // index should always be 101... o___o
                        // this loop looks weird.
                    }
                }
            }));
        }
        public void InsertTweet(FlowLayoutPanel panel, TwitterStatus tweet)
        {
            this.Invoke(new Action(delegate
            {
                // parse tweet source
                string strViaURL  = "https://" + "twitter.com/";
                string strViaName = tweet.Source;
                if (strViaName != "web")
                {
                    Match match = Regex.Match(strViaName, @"<a href=""(.*)"" .*>(.*)</a>");
                    if (match.Success)
                    {
                        strViaURL  = match.Groups[1].Value;
                        strViaName = match.Groups[2].Value;
                    }
                }

                // insert new tweet in list
                TweetControl tc = new TweetControl();
                Global.DownloadImageToPictureBox(tc.picAvatar, tweet.User.ProfileImageSecureLocation, this);
                tc.labelFollowers.Text = tweet.User.NumberOfFollowers.Value.ToString();
                tc.labelName.Text      = tweet.User.ScreenName;
                tc.labelDate.Text      = FormatDate(tweet.CreatedDate);
                tc.labelVia.Text       = "via " + strViaName;
                if (tweet.InReplyToStatusId.HasValue)
                {
                    tc.labelInReplyTo.Text = "in reply to " + tweet.InReplyToScreenName;
                }
                else
                {
                    tc.labelInReplyTo.Text = "";
                }
                //tc.labelText.Text = tweet.Text;
                tc.rtText.Text = HttpUtility.HtmlDecode(tweet.Text);
                FindAlternativeLinks(tc.rtText);
                tc.Width   = panel.Width - 8 - panel.Padding.Right;
                tc.Tweet   = tweet;
                tc.ViaURL  = strViaURL;
                tc.ViaName = strViaName;
                panel.Controls.Add(tc);
                panel.Controls.SetChildIndex(tc, 0);

                // limit amount of tweets in list
                if (panel.Controls.Count > 100)
                {
                    // delete anything after 100
                    for (int i = 101; i < panel.Controls.Count; i++)
                    {
                        panel.Controls.RemoveAt(101); // index should always be 101... o___o
                        // ...this loop looks weird.
                    }
                }
            }));
        }
        public void InsertTweet(FlowLayoutPanel panel, TwitterStatus tweet)
        {
            this.Invoke(new Action(delegate
              {
            // parse tweet source
            string strViaURL = "https://" + "twitter.com/";
            string strViaName = tweet.Source;
            if (strViaName != "web") {
              Match match = Regex.Match(strViaName, @"<a href=""(.*)"" .*>(.*)</a>");
              if (match.Success) {
            strViaURL = match.Groups[1].Value;
            strViaName = match.Groups[2].Value;
              }
            }

            // insert new tweet in list
            TweetControl tc = new TweetControl();
            Global.DownloadImageToPictureBox(tc.picAvatar, tweet.User.ProfileImageSecureLocation, this);
            tc.labelFollowers.Text = tweet.User.NumberOfFollowers.Value.ToString();
            tc.labelName.Text = tweet.User.ScreenName;
            tc.labelDate.Text = FormatDate(tweet.CreatedDate);
            tc.labelVia.Text = "via " + strViaName;
            if (tweet.InReplyToStatusId.HasValue) {
              tc.labelInReplyTo.Text = "in reply to " + tweet.InReplyToScreenName;
            } else {
              tc.labelInReplyTo.Text = "";
            }
            //tc.labelText.Text = tweet.Text;
            tc.rtText.Text = HttpUtility.HtmlDecode(tweet.Text);
            FindAlternativeLinks(tc.rtText);
            tc.Width = panel.Width - 8 - panel.Padding.Right;
            tc.Tweet = tweet;
            tc.ViaURL = strViaURL;
            tc.ViaName = strViaName;
            panel.Controls.Add(tc);
            panel.Controls.SetChildIndex(tc, 0);

            // limit amount of tweets in list
            if (panel.Controls.Count > 100) {
              // delete anything after 100
              for (int i = 101; i < panel.Controls.Count; i++) {
            panel.Controls.RemoveAt(101); // index should always be 101... o___o
            // ...this loop looks weird.
              }
            }
              }));
        }