BeginSerializeObject( Object serializedObject ) { DocumentPage dp = serializedObject as DocumentPage; if (dp != null) { Visual pageRootVisual = dp.Visual; bool bManualStartDoc = NgcSerializationManager.StartPage(); SerializableObjectContext serializableObjectContext = SerializableObjectContext.CreateContext(SerializationManager, serializedObject, null, null); NGCPageSerializerContext context = new NGCPageSerializerContext(this, serializableObjectContext, SerializerAction.endPersistObjectData, bManualStartDoc); NgcSerializationManager.OperationStack.Push(context); ReachSerializer serializer = SerializationManager.GetSerializer(pageRootVisual); serializer.SerializeObject(pageRootVisual); } }
BeginSerializeObject( Object serializedObject ) { FixedPage fp = serializedObject as FixedPage; bool bManualStartDoc = NgcSerializationManager.StartPage(); SerializableObjectContext serializableObjectContext = SerializableObjectContext.CreateContext(SerializationManager, serializedObject, null, null); NGCPageSerializerContext context = new NGCPageSerializerContext(this, serializableObjectContext, SerializerAction.endPersistObjectData, bManualStartDoc); NgcSerializationManager.OperationStack.Push(context); Visual visual = (Visual)serializableObjectContext.TargetObject as Visual; Size pageSize = new Size(fp.Width, fp.Height); NgcSerializationManager.PageSize = pageSize; if (visual != null) { NgcSerializationManager.WalkVisual(visual); } }
AsyncOperation( NGCSerializerContext context ) { if (context == null) { } switch (context.Action) { case SerializerAction.endPersistObjectData: { NGCPageSerializerContext ngcPageSerializerContext = context as NGCPageSerializerContext; EndPersistObjectData(ngcPageSerializerContext.IsManualStartDoc); break; } default: { base.AsyncOperation(context); break; } } }