Ejemplo n.º 1
0
        public static StatusText FromString(string sFromStr, List <JsonObject> ljnUrls = null)
        {
            StatusText stFinal = new StatusText();

            stFinal.m_ltstWords = StatusTextElement.ListFromString(sFromStr, ljnUrls);

            return(stFinal);
        }
Ejemplo n.º 2
0
        public static List <StatusTextElement> ListFromString(string sToParse, List <JsonObject> ljoUrls = null)
        {
            string[]                 asWords = Regex.Split(sToParse, C_TWEET_SPLIT_REGEX);
            StatusTextElement        tstCurElement;
            List <StatusTextElement> ltstFinal = new List <StatusTextElement>();
            int iCharCounter = 0;

            for (int i = 0; i < asWords.Length; i++)
            {
                tstCurElement = new StatusTextElement()
                {
                    m_sText        = asWords[i],
                    m_sDisplayText = asWords[i]
                };

                if (Regex.IsMatch(asWords[i], C_URL_REGEX))
                {
                    tstCurElement.m_teType = StatusTextElementType.URL;

                    //find URL
                    if (ljoUrls != null)
                    {
                        tstCurElement.m_sDisplayText = ExpandUrl(tstCurElement.m_sText, ljoUrls);
                    }
                }
                else if ((asWords[i].Length > 0) && (asWords[i][0] == '@'))
                {
                    tstCurElement.m_teType = StatusTextElementType.ScreenName;
                }
                else if ((asWords[i].Length > 0) && (asWords[i][0] == '#'))
                {
                    tstCurElement.m_teType = StatusTextElementType.Hashtag;
                }
                else
                {
                    tstCurElement.m_teType = StatusTextElementType.Normal;
                }

                tstCurElement.m_iCharStart = iCharCounter;
                iCharCounter            += asWords[i].Length;
                tstCurElement.m_iCharEnd = iCharCounter;

                ltstFinal.Add(tstCurElement);
            }

            return(ltstFinal);
        }
Ejemplo n.º 3
0
 private void ttfTextField_TextElementClicked(object sender, StatusTextElement stElement)
 {
     if (TextElementClicked != null)
         TextElementClicked(this, stElement);
 }
Ejemplo n.º 4
0
        private void tmlTimeline_StatusTextClicked(object sender, Status stStatus, StatusTextElement stElement)
        {
            switch (stElement.Type)
            {
                case StatusTextElement.StatusTextElementType.URL:
                    //open browser - let the windows shell handle it
                    System.Diagnostics.Process.Start(stElement.Text);
                    break;

                case StatusTextElement.StatusTextElementType.Hashtag:
                    //show the view for that hashtag
                    break;

                case StatusTextElement.StatusTextElementType.ScreenName:
                    //show the view for that screen name
                    break;
            }
        }
Ejemplo n.º 5
0
 private void Status_TextElementClicked(object sender, StatusTextElement stElement)
 {
     if (StatusTextClicked != null)
         StatusTextClicked(this, ((TimelineStatus)sender).StatusObj, stElement);
 }
Ejemplo n.º 6
0
        public static List<StatusTextElement> ListFromString(string sToParse, List<JsonObject> ljoUrls = null)
        {
            string[] asWords = Regex.Split(sToParse, C_TWEET_SPLIT_REGEX);
            StatusTextElement tstCurElement;
            List<StatusTextElement> ltstFinal = new List<StatusTextElement>();
            int iCharCounter = 0;

            for (int i = 0; i < asWords.Length; i++)
            {
                tstCurElement = new StatusTextElement()
                {
                    m_sText = asWords[i],
                    m_sDisplayText = asWords[i]
                };

                if (Regex.IsMatch(asWords[i], C_URL_REGEX))
                {
                    tstCurElement.m_teType = StatusTextElementType.URL;

                    //find URL
                    if (ljoUrls != null)
                        tstCurElement.m_sDisplayText = ExpandUrl(tstCurElement.m_sText, ljoUrls);
                }
                else if ((asWords[i].Length > 0) && (asWords[i][0] == '@'))
                    tstCurElement.m_teType = StatusTextElementType.ScreenName;
                else if ((asWords[i].Length > 0) && (asWords[i][0] == '#'))
                    tstCurElement.m_teType = StatusTextElementType.Hashtag;
                else
                    tstCurElement.m_teType = StatusTextElementType.Normal;

                tstCurElement.m_iCharStart = iCharCounter;
                iCharCounter += asWords[i].Length;
                tstCurElement.m_iCharEnd = iCharCounter;

                ltstFinal.Add(tstCurElement);
            }

            return ltstFinal;
        }