Example #1
0
        SerializeNextTreeNode(
            ReachVisualSerializerContext context
            )
        {
            if (context.ContextStack.Count > 0)
            {
                Stack <NodeContext> contextStack = context.ContextStack;
                VisualTreeFlattener flattener    = context.VisualFlattener;

                ReachVisualSerializerContext nextContext = new ReachVisualSerializerContext(this,
                                                                                            contextStack,
                                                                                            flattener,
                                                                                            SerializerAction.serializeNextTreeNode);

                ((IXpsSerializationManagerAsync)SerializationManager).OperationStack.Push(nextContext);


                NodeContext ctx = contextStack.Peek();

                Visual v = ctx.GetNextChild();

                if (v != null)
                {
                    if (flattener.StartVisual(v))
                    {
                        contextStack.Push(new NodeContext(v));
                    }
                }
                else
                {
                    contextStack.Pop();
                    flattener.EndVisual();
                }
            }
        }
Example #2
0
        AsyncOperation(
            ReachSerializerContext context
            )
        {
            if (context == null)
            {
            }

            switch (context.Action)
            {
            case SerializerAction.serializeNextTreeNode:
            {
                ReachVisualSerializerContext thisContext = context as ReachVisualSerializerContext;

                if (thisContext != null)
                {
                    SerializeNextTreeNode(thisContext);
                }

                break;
            }

            default:
            {
                base.AsyncOperation(context);
                break;
            }
            }
        }
Example #3
0
        SerializeTree(
            Visual visual,
            XmlWriter resWriter,
            XmlWriter bodyWriter
            )
        {
            Size fixedPageSize = ((IXpsSerializationManager)SerializationManager).FixedPageSize;

            VisualTreeFlattener flattener = ((IXpsSerializationManagerAsync)SerializationManager).
                                            VisualSerializationService.AcquireVisualTreeFlattener(resWriter,
                                                                                                  bodyWriter,
                                                                                                  fixedPageSize);

            if (flattener.StartVisual(visual))
            {
                Stack <NodeContext> contextStack = new Stack <NodeContext>();
                contextStack.Push(new NodeContext(visual));

                ReachVisualSerializerContext context = new ReachVisualSerializerContext(this,
                                                                                        contextStack,
                                                                                        flattener,
                                                                                        SerializerAction.serializeNextTreeNode);

                ((IXpsSerializationManagerAsync)SerializationManager).OperationStack.Push(context);
            }
        }