Пример #1
0
        private static void CollectInlineFromBlocks(BlockCollection blocks, List <Inline> ic)
        {
            IEnumerator <Block> enumerator = blocks.GetEnumerator();

            enumerator.Reset();
            while (enumerator.MoveNext())
            {
                Block current = enumerator.Current;
                if (current is Paragraph)
                {
                    Paragraph            paragraph   = current as Paragraph;
                    IEnumerator <Inline> enumerator2 = paragraph.Inlines.GetEnumerator();
                    enumerator2.Reset();
                    while (enumerator2.MoveNext())
                    {
                        Inline item = enumerator2.Current;
                        if (item is InlineUIContainer)
                        {
                            InlineUIContainer container      = item as InlineUIContainer;
                            UIElement         childUIElement = ReplaceWithMyControls(container.Child);
                            ic.Add(new InlineUIContainer(childUIElement));
                        }
                        else
                        {
                            ic.Add(item);
                        }
                    }
                    ic.Add(new LineBreak());
                }
                else if (current is Section)
                {
                    Section section = current as Section;
                    CollectInlineFromBlocks(section.Blocks, ic);
                }
                else if (current is BlockUIContainer)
                {
                    BlockUIContainer container2 = current as BlockUIContainer;
                    UIElement        element2   = ReplaceWithMyControls(container2.Child);
                    ic.Add(new InlineUIContainer(element2));
                    ic.Add(new LineBreak());
                }
            }
        }
Пример #2
0
 private static void CollectInlineFromBlocks(BlockCollection blocks, List<Inline> ic)
 {
     IEnumerator<Block> enumerator = blocks.GetEnumerator();
     enumerator.Reset();
     while (enumerator.MoveNext())
     {
         Block current = enumerator.Current;
         if (current is Paragraph)
         {
             Paragraph paragraph = current as Paragraph;
             IEnumerator<Inline> enumerator2 = paragraph.Inlines.GetEnumerator();
             enumerator2.Reset();
             while (enumerator2.MoveNext())
             {
                 Inline item = enumerator2.Current;
                 if (item is InlineUIContainer)
                 {
                     InlineUIContainer container = item as InlineUIContainer;
                     UIElement childUIElement = ReplaceWithMyControls(container.Child);
                     ic.Add(new InlineUIContainer(childUIElement));
                 }
                 else
                 {
                     ic.Add(item);
                 }
             }
             ic.Add(new LineBreak());
         }
         else if (current is Section)
         {
             Section section = current as Section;
             CollectInlineFromBlocks(section.Blocks, ic);
         }
         else if (current is BlockUIContainer)
         {
             BlockUIContainer container2 = current as BlockUIContainer;
             UIElement element2 = ReplaceWithMyControls(container2.Child);
             ic.Add(new InlineUIContainer(element2));
             ic.Add(new LineBreak());
         }
     }
 }