void WriteHighlightedCommentLine(ISmartTextOutput output, string text, int startColumn, int endColumn, bool isSingleLine) { if (startColumn > text.Length) { Debug.Fail("startColumn is invalid"); startColumn = text.Length; } if (endColumn > text.Length) { Debug.Fail("endColumn is invalid"); endColumn = text.Length; } output.Write("// "); output.BeginSpan(gray); if (isSingleLine) { output.Write(text.Substring(0, startColumn).TrimStart()); } else { output.Write(text.Substring(0, startColumn)); } output.EndSpan(); output.Write(text.Substring(startColumn, endColumn - startColumn)); output.BeginSpan(gray); output.Write(text.Substring(endColumn)); output.EndSpan(); output.WriteLine(); }
public void Write(ISmartTextOutput textOutput) { textOutput.WriteLine(); textOutput.Write("This is a test."); textOutput.WriteLine(); textOutput.WriteLine(); textOutput.BeginSpan(new HighlightingColor { Background = new SimpleHighlightingBrush(Colors.Black), FontStyle = FontStyle.Italic, Foreground = new SimpleHighlightingBrush(Colors.Aquamarine) }); textOutput.Write("DO NOT PRESS THIS BUTTON --> "); textOutput.AddButton(null, "Test!", (sender, args) => MessageBox.Show("Naughty Naughty!", "Naughty!", MessageBoxButton.OK, MessageBoxImage.Exclamation)); textOutput.Write(" <--"); textOutput.WriteLine(); textOutput.EndSpan(); textOutput.WriteLine(); }