private static string RenderXamlForlist(string name, IAstList <IAst> items) { return(@" <Span xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'> <Span Foreground = 'blue'>" + Utils.Escape(name) + @"</Span>* <Span Foreground = 'gray'>Count: </Span> " + items.Count + @" </Span>"); }
private static string RenderXamlForValue(PropertyInfo prop, object obj) { if (obj == null) { obj = "<null>"; } var header = ""; var tooltip = ""; if (prop != null) { var color = "SlateBlue"; var prefix = ""; var attr = (PropertyAttribute)prop.GetCustomAttributes(typeof(PropertyAttribute), false).FirstOrDefault(); if (attr != null && attr.IsDependent) { color = "green"; prefix = attr.IsOut ? "<Span Foreground='blue'>out</Span> " : "<Span Foreground='blue'>in</Span> "; tooltip = "ToolTip='" + Utils.Escape(attr.FullName) + "'"; } header = prefix + "<Bold><Span Foreground='" + color + "'>" + Utils.Escape(prop.Name) + "</Span></Bold>: "; } return("<Span xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' " + tooltip + ">" + header + Utils.Escape(obj.ToString()) + "</Span>"); }
private static string RenderXamlForSeq(string name, int count) { return(@" <Span xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'> <Span Foreground = 'green'>" + Utils.Escape(name) + @"</Span> <Span Foreground = 'gray'>(List) Count: </Span> " + count + @" </Span>"); }
private static string RenderXamlForSeq(string name, int count, IEnumerable items) { var txt = items.ToString(); txt = txt.Length > 80 ? txt.Substring(0, 80) + "…" : txt; return(@" <Span xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'> <Span Foreground = 'green'>" + Utils.Escape(name) + @"</Span> <Span Foreground = 'gray'>(List) Count: </Span> " + count + " '" + txt + @"' </Span>"); }
private static string RenderXamlForDeclaration(string name, IAst ast) { var declatation = ast as Declaration; var suffix = declatation == null ? null : (": " + Utils.Escape(declatation.Name.Text)); return(@" <Span xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'> " + (string.IsNullOrWhiteSpace(name) ? null : ("<Span Foreground = 'blue'>" + Utils.Escape(name) + "</Span>: ")) + ast.ToXaml() + suffix + @" </Span>"); }