本文整理汇总了C#中ElementNode类的典型用法代码示例。如果您正苦于以下问题:C# ElementNode类的具体用法?C# ElementNode怎么用?C# ElementNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ElementNode类属于命名空间,在下文中一共展示了ElementNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: _SearchBranchForFilters
private void _SearchBranchForFilters(ElementNode node, IEnumerable<ISequenceFilterNode> filters,
Stack<IEnumerable<ISequenceFilterNode>> filtersFound, SequenceFilterLookup lookup)
{
// Must push a single value for each level we enter.
ISequenceFilterNode[] sequenceFilterNodes = _GetFiltersForNode(node, filters);
if (sequenceFilterNodes.Length > 0) {
filtersFound.Push(sequenceFilterNodes);
}
else {
filtersFound.Push(null);
}
if (node.IsLeaf) {
ISequenceFilterNode[] elementFilters = filtersFound.Where(x => x != null).Reverse().SelectMany(x => x).ToArray();
if (elementFilters.Length > 0) {
lookup.AddElementFilters(node.Element, elementFilters);
}
}
else {
foreach (ElementNode childNode in node.Children) {
_SearchBranchForFilters(childNode, filters, filtersFound, lookup);
}
}
// Pop a single value for every level we exit.
filtersFound.Pop();
}
示例2: IsEnabled
private static bool IsEnabled(ElementNode element)
{
if (element.Name != "img")
return false;
return element.GetAttribute("src", true) != null;
}
示例3: PopulateGeneralNodeInfo
private void PopulateGeneralNodeInfo(ElementNode node)
{
if (node == null) {
labelParents.Text = string.Empty;
_tooltip.SetToolTip(labelParents, null);
textBoxName.Text = string.Empty;
}
else {
// update the label with parent info about the node. Any good suggestions or improvements for this?
int parentCount = GetNodeParentGroupCount(node);
List<string> parents = GetNodeParentGroupNames(node);
string labelString = string.Empty, tooltipString = string.Empty;
labelString = string.Format("This element is in {0} group{1}{2}", parentCount, ((parentCount != 1) ? "s" : string.Empty),
((parentCount == 0) ? "." : ": "));
tooltipString = labelString + "\r\n\r\n";
foreach (string p in parents) {
labelString = string.Format("{0}{1}, ", labelString, p);
tooltipString = string.Format("{0}{1}\r\n", tooltipString, p);
}
labelParents.Text = labelString.TrimEnd(new char[] {' ', ','});
tooltipString = tooltipString.TrimEnd(new char[] {'\r', '\n'});
if (labelString.Length > 100) {
_tooltip.SetToolTip(labelParents, tooltipString);
}
else {
_tooltip.SetToolTip(labelParents, null);
}
textBoxName.Text = node.Name;
}
}
示例4: ElementNode
internal ElementNode(string name, string prefix, string xmlns, ElementNode parent)
{
this.name = name;
this.prefix = prefix;
this.xmlns = xmlns;
this.parent = parent;
}
示例5: PreviewIcicle
//const int InitialStringLength = 20;
public PreviewIcicle(PreviewPoint point1, PreviewPoint point2, ElementNode selectedNode, double zoomLevel)
{
// If we are creating this fresh, we need to know so we can add strings, etc. as drawn.
creating = true;
initialNode = selectedNode;
ZoomLevel = zoomLevel;
AddPoint(PointToZoomPoint(point1));
AddPoint(PointToZoomPoint(point2));
if (selectedNode != null) {
if (selectedNode.Children.Count() > 0 && PreviewTools.GetLeafNodes(selectedNode).Count == 0)
{
StringType = StringTypes.Pixel;
_strings = new List<PreviewBaseShape>();
foreach (ElementNode child in selectedNode.Children)
{
int pixelCount = child.Children.Count();
PreviewLine line = new PreviewLine(new PreviewPoint(10, 10), new PreviewPoint(10, 10), pixelCount, child, ZoomLevel);
line.Parent = this;
_strings.Add(line);
}
_stringCount = _strings.Count;
creating = false;
} else
{
StringType = StringTypes.Standard;
}
}
Layout();
}
示例6: RenderNode
// renders the given node to the internal ElementData dictionary. If the given node is
// not a element, will recursively descend until we render its elements.
public static EffectIntents RenderNode(ElementNode node, Curve levelCurve, ColorGradient colorGradient, TimeSpan duration, bool isDiscrete, bool allowZeroIntensity = false)
{
//Collect all the points first.
double[] allPointsTimeOrdered = _GetAllSignificantDataPoints(levelCurve, colorGradient).ToArray();
var elementData = new EffectIntents();
foreach (ElementNode elementNode in node.GetLeafEnumerator())
{
// this is probably always going to be a single element for the given node, as
// we have iterated down to leaf nodes in RenderNode() above. May as well do
// it this way, though, in case something changes in future.
if (elementNode == null || elementNode.Element == null)
continue;
//ElementColorType colorType = ColorModule.getColorTypeForElementNode(elementNode);
if (isDiscrete && IsElementDiscrete(node))
{
IEnumerable<Color> colors = ColorModule.getValidColorsForElementNode(elementNode, false)
.Intersect(colorGradient.GetColorsInGradient());
foreach (Color color in colors)
{
AddIntentsToElement(elementNode.Element, allPointsTimeOrdered, levelCurve, colorGradient, duration, elementData, allowZeroIntensity, color);
}
}
else
{
AddIntentsToElement(elementNode.Element, allPointsTimeOrdered, levelCurve, colorGradient, duration, elementData, allowZeroIntensity);
}
}
return elementData;
}
示例7: RenderNode
// renders the given node to the internal ElementData dictionary. If the given node is
// not a element, will recursively descend until we render its elements.
private void RenderNode(ElementNode node)
{
foreach(Element element in node) {
// this is probably always going to be a single element for the given node, as
// we have iterated down to leaf nodes in RenderNode() above. May as well do
// it this way, though, in case something changes in future.
if (element == null)
continue;
double[] allPointsTimeOrdered = _GetAllSignificantDataPoints().ToArray();
Debug.Assert(allPointsTimeOrdered.Length > 1);
double lastPosition = allPointsTimeOrdered[0];
for(int i=1; i<allPointsTimeOrdered.Length; i++) {
double position = allPointsTimeOrdered[i];
LightingValue startValue = new LightingValue(ColorGradient.GetColorAt(lastPosition), (float)LevelCurve.GetValue(lastPosition * 100) / 100);
LightingValue endValue = new LightingValue(ColorGradient.GetColorAt(position), (float)LevelCurve.GetValue(position * 100) / 100);
TimeSpan startTime = TimeSpan.FromMilliseconds(TimeSpan.TotalMilliseconds * lastPosition);
TimeSpan timeSpan = TimeSpan.FromMilliseconds(TimeSpan.TotalMilliseconds * (position - lastPosition));
IIntent intent = new LightingIntent(startValue, endValue, timeSpan);
_elementData.AddIntentForElement(element.Id, intent, startTime);
lastPosition = position;
}
}
}
示例8: Transform
protected void Transform(ElementNode elementNode, IList<Node> body)
{
foreach (IReplacement replacement in replacements)
{
replacement.DoReplace(elementNode, body);
}
}
示例9: IsEnabled
private static bool IsEnabled(ElementNode element)
{
if (element.Name != "img")
return false;
return element.HasAttribute("src");
}
示例10: RenderNode
// renders the given node to the internal ElementData dictionary. If the given node is
// not a element, will recursively descend until we render its elements.
protected override void RenderNode(ElementNode node)
{
if (!AudioUtilities.AudioLoaded)
return;
foreach (ElementNode elementNode in node.GetLeafEnumerator()) {
// this is probably always going to be a single element for the given node, as
// we have iterated down to leaf nodes in RenderNode() above. May as well do
// it this way, though, in case something changes in future.
if (elementNode == null || elementNode.Element == null)
continue;
bool discreteColors = ColorModule.isElementNodeDiscreteColored(elementNode);
for(int i = 0;i<(int)((TimeSpan.TotalMilliseconds/Spacing)-1);i++)
{
double gradientPosition1 = (AudioUtilities.VolumeAtTime(i * Spacing) + Data.Range)/Data.Range ;
double gradientPosition2 = (AudioUtilities.VolumeAtTime((i+1) * Spacing) + Data.Range)/Data.Range;
if (gradientPosition1 <= 0)
gradientPosition1 = 0;
if (gradientPosition1 >= 1)
gradientPosition1 = 1;
//Some odd corner cases
if (gradientPosition2 <= 0)
gradientPosition2 = 0;
if (gradientPosition2 >= 1)
gradientPosition2 = 1;
TimeSpan startTime = TimeSpan.FromMilliseconds(i * Spacing);
ElementData.Add(GenerateEffectIntents(elementNode, WorkingGradient, MeterIntensityCurve, gradientPosition1, gradientPosition2, TimeSpan.FromMilliseconds(Spacing), startTime, discreteColors));
}
}
}
示例11: AddAttribute
protected static void AddAttribute(ElementNode elementNode, string attributeName, Node childNode)
{
elementNode.RemoveAttributesByName(attributeName);
elementNode.Attributes.Add(
new AttributeNode(
attributeName,
new List<Node> { childNode }));
}
示例12: PreviewMultiString
public PreviewMultiString(PreviewPoint point1, PreviewPoint point2, ElementNode selectedNode, double zoomLevel)
{
ZoomLevel = zoomLevel;
AddPoint(PointToZoomPoint(point1));
_strings = new List<PreviewBaseShape>();
Creating = true;
inputElements = selectedNode;
}
示例13: TryCreateSmartTag
public IHtmlSmartTag TryCreateSmartTag(ITextView textView, ITextBuffer textBuffer, ElementNode element, AttributeNode attribute, int caretPosition, HtmlPositionType positionType)
{
if (element.GetAttribute("class") == null)
{
return new $safeitemname$SmartTag(textView, textBuffer, element);
}
return null;
}
示例14: GetApplicableReplacements
private static IEnumerable<IReplacement> GetApplicableReplacements(ElementNode node)
{
var result = new List<IReplacement>();
result.AddRange(UriReplacementSpecifications.GetMatching(node));
result.AddRange(FormReplacementSpecifications.GetMatching(node));
return result;
}
示例15: TryCreateSmartTag
public IHtmlSmartTag TryCreateSmartTag(ITextView textView, ITextBuffer textBuffer, ElementNode element, AttributeNode attribute, int caretPosition, HtmlPositionType positionType)
{
if (element.Children.Count > 0)
{
return new HtmlRemoveParentSmartTag(textView, textBuffer, element);
}
return null;
}