public static StatusText FromString(string sFromStr, List <JsonObject> ljnUrls = null) { StatusText stFinal = new StatusText(); stFinal.m_ltstWords = StatusTextElement.ListFromString(sFromStr, ljnUrls); return(stFinal); }
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); }
private void ttfTextField_TextElementClicked(object sender, StatusTextElement stElement) { if (TextElementClicked != null) TextElementClicked(this, stElement); }
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; } }
private void Status_TextElementClicked(object sender, StatusTextElement stElement) { if (StatusTextClicked != null) StatusTextClicked(this, ((TimelineStatus)sender).StatusObj, stElement); }
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; }