public static TextChildren GetTextChildren(this widget wt) { string txt = "";// wt.text?.Value as string; if (string.IsNullOrEmpty(txt)) { return(null); } else { var ja = Newtonsoft.Json.JsonConvert.DeserializeObject(txt) as Newtonsoft.Json.Linq.JArray; var childrens = (ja.FirstOrDefault()?.ToObject(typeof(TextObject)) as TextObject)?.children; return(childrens?.FirstOrDefault()); } }
public static string GetText(this widget wt) { if (wt.text == null || !wt.text.HasValues) { return(string.Empty); } else { try { return(wt.text.SelectToken("[0].children[0].text").ToObject <string>()); } catch (Exception) { return(string.Empty); } } }
private static bool Check(widget wt, string st) { return(!string.IsNullOrEmpty(st) && wt != null && !string.IsNullOrEmpty(wt.GetText()) && st.Trim().Split(new char[] { ' ', (char)160 }, StringSplitOptions.RemoveEmptyEntries)[0].Equals(wt.GetText().Replace(" ", "").Replace("" + (char)160, "").Trim())); }