Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / System / Windows / Markup / XamlDesignerSerializationManager.cs / 1305600 / XamlDesignerSerializationManager.cs
//----------------------------------------------------------------------------
//
// File: XamlDesignerSerializationManager.cs
//
// Description:
// Manages the ContextStack for a particular run of Serialization.
//
// Copyright (C) 2003 by Microsoft Corporation. All rights reserved.
//
//---------------------------------------------------------------------------
using System;
using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design.Serialization;
using System.Reflection;
using System.Xml;
namespace System.Windows.Markup
{
///
/// The serialization manager offers three services
/// 1. To store all of the context information
/// for the current run of serialization on a stack.
/// 2. To query a given type for its serializer.
/// 3. To get and set the serialization mode for
/// a given Expression type
///
///
/// As a measure of optimization it also
/// maintains a cache mapping types to
/// serializers, to avoid the overhead of
/// reflecting for the attribute on every
/// query.
///
///
///
//
public class XamlDesignerSerializationManager : ServiceProviders
{
#region Construction
///
/// Constructor for XamlDesignerSerializationManager
///
///
/// XmlWriter
///
public XamlDesignerSerializationManager(XmlWriter xmlWriter)
{
_xamlWriterMode = XamlWriterMode.Value;
_xmlWriter = xmlWriter;
}
#endregion Construction
#region Properties
///
/// The mode of serialization for
/// all Expressions
///
public XamlWriterMode XamlWriterMode
{
get
{
return _xamlWriterMode;
}
set
{
// Validate Input Arguments
if (!IsValidXamlWriterMode(value))
{
throw new InvalidEnumArgumentException("value", (int)value, typeof(XamlWriterMode));
}
_xamlWriterMode = value;
}
}
///
/// XmlWriter
///
internal XmlWriter XmlWriter
{
get { return _xmlWriter; }
}
#endregion Properties
#region Internal Methods
internal void ClearXmlWriter()
{
_xmlWriter = null;
}
#endregion
#region Private Methods
private static bool IsValidXamlWriterMode(XamlWriterMode value)
{
return value == XamlWriterMode.Value
|| value == XamlWriterMode.Expression;
}
#endregion
#region Data
private XamlWriterMode _xamlWriterMode; // Serialization modes
private XmlWriter _xmlWriter; //XmlWriter
#endregion Data
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------------------
//
// File: XamlDesignerSerializationManager.cs
//
// Description:
// Manages the ContextStack for a particular run of Serialization.
//
// Copyright (C) 2003 by Microsoft Corporation. All rights reserved.
//
//---------------------------------------------------------------------------
using System;
using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design.Serialization;
using System.Reflection;
using System.Xml;
namespace System.Windows.Markup
{
///
/// The serialization manager offers three services
/// 1. To store all of the context information
/// for the current run of serialization on a stack.
/// 2. To query a given type for its serializer.
/// 3. To get and set the serialization mode for
/// a given Expression type
///
///
/// As a measure of optimization it also
/// maintains a cache mapping types to
/// serializers, to avoid the overhead of
/// reflecting for the attribute on every
/// query.
///
///
///
//
public class XamlDesignerSerializationManager : ServiceProviders
{
#region Construction
///
/// Constructor for XamlDesignerSerializationManager
///
///
/// XmlWriter
///
public XamlDesignerSerializationManager(XmlWriter xmlWriter)
{
_xamlWriterMode = XamlWriterMode.Value;
_xmlWriter = xmlWriter;
}
#endregion Construction
#region Properties
///
/// The mode of serialization for
/// all Expressions
///
public XamlWriterMode XamlWriterMode
{
get
{
return _xamlWriterMode;
}
set
{
// Validate Input Arguments
if (!IsValidXamlWriterMode(value))
{
throw new InvalidEnumArgumentException("value", (int)value, typeof(XamlWriterMode));
}
_xamlWriterMode = value;
}
}
///
/// XmlWriter
///
internal XmlWriter XmlWriter
{
get { return _xmlWriter; }
}
#endregion Properties
#region Internal Methods
internal void ClearXmlWriter()
{
_xmlWriter = null;
}
#endregion
#region Private Methods
private static bool IsValidXamlWriterMode(XamlWriterMode value)
{
return value == XamlWriterMode.Value
|| value == XamlWriterMode.Expression;
}
#endregion
#region Data
private XamlWriterMode _xamlWriterMode; // Serialization modes
private XmlWriter _xmlWriter; //XmlWriter
#endregion Data
}
}
// 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
- EventLogger.cs
- SingleTagSectionHandler.cs
- XmlHierarchicalDataSourceView.cs
- ComponentEvent.cs
- PipelineComponent.cs
- AspCompat.cs
- QueryContinueDragEventArgs.cs
- BindingSource.cs
- SpeechRecognizer.cs
- GAC.cs
- DataObject.cs
- FormViewPageEventArgs.cs
- SparseMemoryStream.cs
- XmlQueryCardinality.cs
- Inflater.cs
- Message.cs
- WindowsRichEdit.cs
- BinaryFormatterWriter.cs
- ImageClickEventArgs.cs
- EntityException.cs
- ColumnHeader.cs
- DynamicExpression.cs
- NativeCompoundFileAPIs.cs
- RightsManagementErrorHandler.cs
- IsolatedStorageFilePermission.cs
- PKCS1MaskGenerationMethod.cs
- StickyNoteAnnotations.cs
- WindowsListBox.cs
- GZipStream.cs
- XamlFilter.cs
- PropertyInfoSet.cs
- XmlExtensionFunction.cs
- XsdValidatingReader.cs
- VariableAction.cs
- ToolZone.cs
- AuthenticationService.cs
- safex509handles.cs
- BindingCollectionElement.cs
- AdvancedBindingEditor.cs
- HttpAsyncResult.cs
- PropertyRecord.cs
- Visitor.cs
- Schema.cs
- XmlWriterSettings.cs
- PeerCollaboration.cs
- SqlServices.cs
- ProgressBarBrushConverter.cs
- ArcSegment.cs
- diagnosticsswitches.cs
- ViewManager.cs
- ReceiveContent.cs
- UserControl.cs
- DBConnection.cs
- ComponentCollection.cs
- DataListCommandEventArgs.cs
- ClientSettingsStore.cs
- ResourceDescriptionAttribute.cs
- TabletDeviceInfo.cs
- FileLogRecordStream.cs
- TabItemWrapperAutomationPeer.cs
- ZipIORawDataFileBlock.cs
- FormViewDeletedEventArgs.cs
- WebScriptMetadataMessageEncodingBindingElement.cs
- SQLByte.cs
- LayoutEditorPart.cs
- QueryAccessibilityHelpEvent.cs
- WorkflowServiceAttributes.cs
- MediaPlayerState.cs
- FilterRepeater.cs
- XsltLibrary.cs
- TraceListener.cs
- CellParagraph.cs
- CacheManager.cs
- KerberosReceiverSecurityToken.cs
- HtmlTernaryTree.cs
- ValueUnavailableException.cs
- ThreadInterruptedException.cs
- InlineObject.cs
- BasePattern.cs
- ConfigurationSection.cs
- TriggerBase.cs
- GridSplitter.cs
- XmlSerializerNamespaces.cs
- EntityDataSourceWrapper.cs
- SystemDiagnosticsSection.cs
- TextFormatterHost.cs
- HashHelper.cs
- KernelTypeValidation.cs
- LocalValueEnumerator.cs
- Options.cs
- SafeSecurityHandles.cs
- RoutedEvent.cs
- InvalidDataContractException.cs
- DesignerHelpers.cs
- RootBuilder.cs
- ADConnectionHelper.cs
- TypeResolver.cs
- TableParaClient.cs
- C14NUtil.cs
- Util.cs