SerializeNextDocumentPage( ReachSerializerContext context ) { DocumentPaginatorSerializerContext paginatorContext = context as DocumentPaginatorSerializerContext; if (paginatorContext != null) { DocumentPaginator paginator = paginatorContext.Paginator; int index = paginatorContext.Index; if (!paginator.IsPageCountValid || (index < paginator.PageCount)) { index++; DocumentPaginatorSerializerContext collectionContext = new DocumentPaginatorSerializerContext(this, paginatorContext.ObjectContext, paginator, index, SerializerAction.serializeNextDocumentPage); _xpsOMSerializationManagerAsync.OperationStack.Push(collectionContext); DocumentPage page = Toolbox.GetPage(paginator, index - 1); ReachSerializer serializer = SerializationManager.GetSerializer(page); if (serializer != null) { serializer.SerializeObject(page); } } } }
PersistObjectData( SerializableObjectContext serializableObjectContext ) { DocumentPaginator paginator = _syncSerializer.BeginPersistObjectData(serializableObjectContext); ReachSerializerContext context = new ReachSerializerContext(this, SerializerAction.endPersistObjectData); _xpsOMSerializationManagerAsync.OperationStack.Push(context); int index = 0; DocumentPaginatorSerializerContext collectionContext = new DocumentPaginatorSerializerContext(this, serializableObjectContext, paginator, index, SerializerAction.serializeNextDocumentPage); _xpsOMSerializationManagerAsync.OperationStack.Push(collectionContext); }
PersistObjectData( SerializableObjectContext serializableObjectContext ) { if (SerializationManager is XpsSerializationManager) { (SerializationManager as XpsSerializationManager).RegisterDocumentStart(); } String xmlnsForType = SerializationManager.GetXmlNSForType(typeof(FixedDocument)); String nameForType = XpsS0Markup.FixedDocument; if (xmlnsForType == null) { XmlWriter.WriteStartElement(nameForType); } else { XmlWriter.WriteStartElement(nameForType, xmlnsForType); } { ReachSerializerContext context = new ReachSerializerContext(this, SerializerAction.endPersistObjectData); ((IXpsSerializationManagerAsync)SerializationManager).OperationStack.Push(context); XpsSerializationPrintTicketRequiredEventArgs e = new XpsSerializationPrintTicketRequiredEventArgs(PrintTicketLevel.FixedDocumentPrintTicket, 0); ((IXpsSerializationManager)SerializationManager).OnXPSSerializationPrintTicketRequired(e); // // Serialize the data for the PrintTicket // if (e.Modified) { if (e.PrintTicket != null) { PrintTicketSerializerAsync serializer = new PrintTicketSerializerAsync(SerializationManager); serializer.SerializeObject(e.PrintTicket); } } DocumentPaginator paginator = (DocumentPaginator)serializableObjectContext.TargetObject; XmlLanguage language = null; DependencyObject dependencyObject = paginator.Source as DependencyObject; if (dependencyObject != null) { language = (XmlLanguage)dependencyObject.GetValue(FrameworkContentElement.LanguageProperty); } if (language == null) { //If the language property is null, assign the language to the default language = XmlLanguage.GetLanguage(XpsS0Markup.XmlLangValue); } SerializationManager.Language = language; int index = 0; DocumentPaginatorSerializerContext collectionContext = new DocumentPaginatorSerializerContext(this, serializableObjectContext, paginator, index, SerializerAction.serializeNextDocumentPage); ((IXpsSerializationManagerAsync)SerializationManager).OperationStack.Push(collectionContext); } }