public static object CreateEntityDescription(string ambienceDescription, string xmlDocumentation = null) { try { var panel = new StackPanel(); panel.Orientation = Orientation.Vertical; var codeControl = new CsTextEditor(); codeControl.IsEnabled = false; codeControl.Text = ambienceDescription; codeControl.HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden; codeControl.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden; codeControl.Background = Brushes.Transparent; panel.Children.Add(codeControl); if (xmlDocumentation != null) { var xml = ParseXml(xmlDocumentation); var documentationBlock = new TextBlock(); var summary = xml.SelectSingleNode("//my_custom_xml_wrapper/summary"); documentationBlock.Text = FixupXmlText(summary.InnerText); panel.Children.Add(documentationBlock); } return(panel); } catch (Exception) { return(ambienceDescription); } }
private static CsTextEditor CreateReadonlyCsTextEditor(string text) { var codeControl = new CsTextEditor("Consolas", 14, 4); codeControl.IsEnabled = false; codeControl.Text = text; codeControl.HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden; codeControl.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden; codeControl.Background = Brushes.Transparent; codeControl.Options.HighlightCurrentLine = false; codeControl.Options.HideCursorWhileTyping = true; return(codeControl); }
public object GetSyntaxWithParameterHighlighted(int currentParameter) { var codeControl = new CsTextEditor(); codeControl.IsEnabled = false; codeControl.Text = AmbienceDescription; codeControl.HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden; codeControl.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden; codeControl.Background = Brushes.Transparent; var finder = new FindParameterTokenWriter(currentParameter); ambience.ConvertSymbol(Entity, finder, FormattingOptionsFactory.CreateSharpDevelop()); codeControl.Select(finder.ParameterStart, finder.ParameterEnd - finder.ParameterStart); return(codeControl); }
private UIElement CreateCSharpCode(string code) { var panel = new StackPanel(); panel.Orientation = Orientation.Horizontal; var textBlock = new TextBlock(); textBlock.FontFamily = new FontFamily("Consolas"); textBlock.FontSize = 14; textBlock.Text = InteractiveExecution.DefaultPrompt; panel.Children.Add(textBlock); var codeControl = new CsTextEditor(); codeControl.IsEnabled = false; codeControl.Text = code; codeControl.HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden; codeControl.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden; codeControl.Background = Brushes.Transparent; panel.Children.Add(codeControl); return panel; }