本文整理汇总了C#中ElementNode.GetText方法的典型用法代码示例。如果您正苦于以下问题:C# ElementNode.GetText方法的具体用法?C# ElementNode.GetText怎么用?C# ElementNode.GetText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ElementNode
的用法示例。
在下文中一共展示了ElementNode.GetText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TryCreateSmartTag
public IHtmlSmartTag TryCreateSmartTag(ITextView textView, ITextBuffer textBuffer, ElementNode element, AttributeNode attribute, int caretPosition, HtmlPositionType positionType)
{
if (element.InnerRange == null || element.GetText(element.InnerRange).Trim().Length == 0)
return null;
string displayText = element.Children.Count == 0 ? "Remove HTML tag" : "Remove and keep children";
return new HtmlRemoveParentSmartTag(textView, textBuffer, element, displayText);
}
示例2: Visit
public bool Visit(ElementNode element, object parameter)
{
if (element.Name.Equals("title", StringComparison.OrdinalIgnoreCase))
{
var list = (HashSet<string>)parameter;
string text = element.GetText(element.InnerRange);
list.Add(text);
}
return true;
}
示例3: PlaceCaret
private void PlaceCaret(ElementNode element, int position)
{
SnapshotPoint point = new SnapshotPoint(TextView.TextBuffer.CurrentSnapshot, TextView.Caret.Position.BufferPosition.Position);
if (element.EndTag == null)
return;
if (element.EndTag.Start == point.Position)
{
string text = element.GetText(element.InnerRange);
for (int i = text.Length -1; i > -1; i--)
{
if (!char.IsWhiteSpace(text[i]))
{
TextView.Caret.MoveTo(new SnapshotPoint(TextView.TextBuffer.CurrentSnapshot, element.InnerRange.Start + i + 1));
break;
}
}
}
else
{
IWpfTextViewLine line = TextView.GetTextViewLineContainingBufferPosition(point);
string text = TextView.TextBuffer.CurrentSnapshot.GetText(line.Start.Position, line.Length);
for (int i = 0; i < text.Length; i++)
{
if (!char.IsWhiteSpace(text[i]))
{
TextView.Caret.MoveTo(new SnapshotPoint(TextView.TextBuffer.CurrentSnapshot, line.Start.Position + i));
break;
}
}
}
}