Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Print / Reach / Serialization / manager / ReachDocumentSequenceSerializerAsync.cs / 1 / ReachDocumentSequenceSerializerAsync.cs
/*++ Copyright (C) 2004- 2005 Microsoft Corporation All rights reserved. Module Name: ReachDocumentSequenceSerializerAsync.cs Abstract: Author: [....] ([....]) 25-May-2005 Revision History: --*/ using System; using System.Collections; using System.Collections.Specialized; using System.ComponentModel; using System.Diagnostics; using System.Reflection; using System.Xml; using System.IO; using System.Security; using System.Security.Permissions; using System.ComponentModel.Design.Serialization; using System.Windows.Xps.Packaging; using System.Windows.Documents; using System.Windows.Media; using System.Windows.Markup; namespace System.Windows.Xps.Serialization { ////// /// internal class DocumentSequenceSerializerAsync : ReachSerializerAsync { ////// /// public DocumentSequenceSerializerAsync( PackageSerializationManager manager ): base(manager) { } public override void AsyncOperation( ReachSerializerContext context ) { if(context == null) { } switch (context.Action) { case SerializerAction.endPersistObjectData: { EndPersistObjectData(); break; } default: { base.AsyncOperation(context); break; } } } ////// /// internal override void PersistObjectData( SerializableObjectContext serializableObjectContext ) { String xmlnsForType = SerializationManager.GetXmlNSForType(typeof(FixedDocumentSequence)); if( SerializationManager is XpsSerializationManager) { (SerializationManager as XpsSerializationManager).RegisterDocumentSequenceStart(); } if(xmlnsForType == null) { XmlWriter.WriteStartElement(serializableObjectContext.Name); } else { XmlWriter.WriteStartElement(serializableObjectContext.Name, xmlnsForType); } { ReachSerializerContext context = new ReachSerializerContext(this, SerializerAction.endPersistObjectData); ((XpsSerializationManagerAsync)SerializationManager).OperationStack.Push(context); if(serializableObjectContext.IsComplexValue) { XpsSerializationPrintTicketRequiredEventArgs e = new XpsSerializationPrintTicketRequiredEventArgs(PrintTicketLevel.FixedDocumentSequencePrintTicket, 0); ((XpsSerializationManagerAsync)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); } } SerializeObjectCore(serializableObjectContext); } else { } } } internal override void EndPersistObjectData( ) { XmlWriter.WriteEndElement(); XmlWriter = null; // // Signal to any registered callers that the Sequence has been serialized // XpsSerializationProgressChangedEventArgs progressEvent = new XpsSerializationProgressChangedEventArgs(XpsWritingProgressChangeLevel.FixedDocumentSequenceWritingProgress, 0, 0, null); if( SerializationManager is XpsSerializationManager) { (SerializationManager as XpsSerializationManager).RegisterDocumentSequenceEnd(); } ((XpsSerializationManager)SerializationManager).OnXPSSerializationProgressChanged(progressEvent); } ////// /// public override XmlWriter XmlWriter { get { if(base.XmlWriter == null) { base.XmlWriter = SerializationManager.AcquireXmlWriter(typeof(FixedDocumentSequence)); } return base.XmlWriter; } set { base.XmlWriter = null; SerializationManager.ReleaseXmlWriter(typeof(FixedDocumentSequence)); } } ////// /// internal override void WriteSerializedAttribute( SerializablePropertyContext serializablePropertyContext ) { if(serializablePropertyContext == null) { throw new ArgumentNullException("serializablePropertyContext"); } String attributeValue = String.Empty; attributeValue = GetValueOfAttributeAsString(serializablePropertyContext); if ( (attributeValue != null) && (attributeValue.Length > 0) ) { // // Emit name="value" attribute // XmlWriter.WriteAttributeString(serializablePropertyContext.Name, attributeValue); } } internal String GetValueOfAttributeAsString( SerializablePropertyContext serializablePropertyContext ) { if(serializablePropertyContext == null) { throw new ArgumentNullException("serializablePropertyContext"); } String valueAsString = null; Object targetObjectContainingProperty = serializablePropertyContext.TargetObject; Object propertyValue = serializablePropertyContext.Value; if(propertyValue != null) { TypeConverter typeConverter = serializablePropertyContext.TypeConverter; valueAsString = typeConverter.ConvertToInvariantString(new XpsTokenContext(SerializationManager, serializablePropertyContext), propertyValue); if (typeof(Type).IsInstanceOfType(propertyValue)) { int index = valueAsString.LastIndexOf('.'); if (index > 0) { valueAsString = valueAsString.Substring(index + 1); } valueAsString = XpsSerializationManager.TypeOfString + valueAsString + ")"; } } else { valueAsString = XpsSerializationManager.NullString; } return valueAsString; } }; } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- XmlCharCheckingWriter.cs
- TimeSpanParse.cs
- HtmlElementEventArgs.cs
- OutputCacheProfile.cs
- SortFieldComparer.cs
- ResourceContainer.cs
- XmlnsCompatibleWithAttribute.cs
- IisTraceWebEventProvider.cs
- xmlglyphRunInfo.cs
- NameValueSectionHandler.cs
- XmlSecureResolver.cs
- RichTextBoxDesigner.cs
- Serializer.cs
- SafeCryptContextHandle.cs
- Misc.cs
- Lazy.cs
- streamingZipPartStream.cs
- WithStatement.cs
- typedescriptorpermissionattribute.cs
- CodeAccessSecurityEngine.cs
- JavascriptCallbackMessageInspector.cs
- SafeViewOfFileHandle.cs
- StateDesigner.TransitionInfo.cs
- UdpContractFilterBehavior.cs
- PropagationProtocolsTracing.cs
- PageRequestManager.cs
- WebProxyScriptElement.cs
- SystemIcmpV4Statistics.cs
- DataColumnMappingCollection.cs
- RedBlackList.cs
- ContextMarshalException.cs
- SecurityContext.cs
- EmptyEnumerator.cs
- PersistenceTask.cs
- And.cs
- AbstractSvcMapFileLoader.cs
- FieldMetadata.cs
- RectangleConverter.cs
- DrawingImage.cs
- XmlSchemaValidator.cs
- HttpPostLocalhostServerProtocol.cs
- AssemblyHash.cs
- Model3DGroup.cs
- RequestCachingSection.cs
- CodeSnippetStatement.cs
- TemplateBindingExpressionConverter.cs
- BaseCodeDomTreeGenerator.cs
- SystemException.cs
- RestClientProxyHandler.cs
- TemplateNodeContextMenu.cs
- XDRSchema.cs
- CommonRemoteMemoryBlock.cs
- TextAdaptor.cs
- SafeFreeMibTable.cs
- WebServiceReceiveDesigner.cs
- ListSourceHelper.cs
- PrimitiveDataContract.cs
- MetadataFile.cs
- _NTAuthentication.cs
- _AuthenticationState.cs
- BooleanAnimationUsingKeyFrames.cs
- XmlSchemaSimpleTypeRestriction.cs
- SqlRowUpdatedEvent.cs
- mediapermission.cs
- PropertyInformation.cs
- CacheMemory.cs
- Nullable.cs
- InheritanceContextChangedEventManager.cs
- ViewPort3D.cs
- MultitargetingHelpers.cs
- XPathQilFactory.cs
- ContextStack.cs
- SafeFileHandle.cs
- XmlEnumAttribute.cs
- HistoryEventArgs.cs
- Typeface.cs
- DataGridCaption.cs
- DataViewManagerListItemTypeDescriptor.cs
- ConnectionManagementElement.cs
- AnimationException.cs
- RtfToXamlReader.cs
- PasswordPropertyTextAttribute.cs
- TextServicesCompartmentContext.cs
- BaseTemplateCodeDomTreeGenerator.cs
- CompressionTransform.cs
- Cloud.cs
- EngineSiteSapi.cs
- VBCodeProvider.cs
- MarkupProperty.cs
- SafeRightsManagementHandle.cs
- XmlReader.cs
- SystemException.cs
- WindowPatternIdentifiers.cs
- ISCIIEncoding.cs
- RecordsAffectedEventArgs.cs
- BitArray.cs
- ListViewGroupConverter.cs
- FilePresentation.cs
- OverlappedAsyncResult.cs
- SharedDp.cs