Exemplo n.º 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();
                }
            }
        }
Exemplo n.º 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;
            }
            }
        }
Exemplo n.º 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);
            }
        }