示例#1
0
        public static void ProcessChildren(XamlContext ctx, BamlBlockNode node, BamlElement nodeElem)
        {
            ctx.XmlNs.PushScope(nodeElem);
            if (nodeElem.Xaml.Element != null)
            {
                nodeElem.Xaml.Element.AddAnnotation(ctx.XmlNs.CurrentScope);
            }
            foreach (var child in node.Children)
            {
                var handler = LookupHandler(child.Type);
                if (handler == null)
                {
                    Debug.WriteLine("BAML Handler {0} not implemented.", child.Type);
                    continue;
                }
                var elem = handler.Translate(ctx, (BamlNode)child, nodeElem);
                if (elem != null)
                {
                    nodeElem.Children.Add(elem);
                    elem.Parent = nodeElem;
                }

                ctx.CancellationToken.ThrowIfCancellationRequested();
            }
            ctx.XmlNs.PopScope();
        }
示例#2
0
        void BuildNodeMap(BamlBlockNode node)
        {
            if (node == null)
            {
                return;
            }

            NodeMap[node.Header] = node;

            foreach (var child in node.Children)
            {
                if (child is BamlBlockNode childBlock)
                {
                    BuildNodeMap(childBlock);
                }
            }
        }
示例#3
0
        void BuildNodeMap(BamlBlockNode node, RecursionCounter counter)
        {
            if (node is null || !counter.Increment())
            {
                return;
            }

            NodeMap[node.Header] = node;

            foreach (var child in node.Children)
            {
                if (child is BamlBlockNode childBlock)
                {
                    BuildNodeMap(childBlock, counter);
                }
            }

            counter.Decrement();
        }