ReachDocumentReferenceSerializer.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Print / Reach / Serialization / manager / ReachDocumentReferenceSerializer.cs / 1 / ReachDocumentReferenceSerializer.cs

                            /*++ 

    Copyright (C) 2004- 2005 Microsoft Corporation
    All rights reserved.
 
    Module Name:
        ReachDocumentReferenceSerializer.cs 
 
    Abstract:
 
    Author:
        [....] ([....]) January 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;
using System.Windows.Threading; 

namespace System.Windows.Xps.Serialization 
{ 
    /// 
    /// 
    /// 
    internal class ReachDocumentReferenceSerializer :
                   ReachSerializer
    { 
        /// 
        /// Creates a new serailizer for a DocumentReference 
        ///  
        /// serialization manager
        public 
        ReachDocumentReferenceSerializer(
            PackageSerializationManager   manager
            ):
        base(manager) 
        {
 
        } 

        private object Idle(object sender) 
        {
            return null;
        }
 
        /// 
        /// 
        ///  
        internal
        override 
        void
        PersistObjectData(
            SerializableObjectContext   serializableObjectContext
            ) 
        {
            if(serializableObjectContext.IsComplexValue) 
            { 
                SerializeObjectCore(serializableObjectContext);
 
                // Loads the document
                FixedDocument document = ((DocumentReference)serializableObjectContext.TargetObject).GetDocument(false);

                if (document.IsInitialized == false) 
                {
                    // Give a parser item a kick 
                    document.Dispatcher.Invoke(DispatcherPriority.ApplicationIdle, 
                        new DispatcherOperationCallback(Idle), null);
                } 

                if(document != null)
                {
                    ReachSerializer serializer = SerializationManager.GetSerializer(document); 

                    if(serializer!=null) 
                    { 
                        serializer.SerializeObject(document);
                    } 
                    else
                    {
                        // This shouldn't ever happen.
                        throw new XpsSerializationException(ReachSR.Get(ReachSRID.ReachSerialization_NoSerializer)); 
                    }
                } 
            } 
            else
            { 
                // What about this case?  Is IsComplexValue something we really want to check for this?
            }
        }
    }; 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK