Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / System / Windows / Markup / TypeContext.cs / 1305600 / TypeContext.cs
//----------------------------------------------------------------------------
//
// File: typeContext.cs
//
// Description:
// class for the main TypeConverterContext object passed to type converters
//
//
// History:
// 8/02/01: rogerg Created
// 05/23/03: peterost Ported to wcp
//
// Copyright (C) 2001 by Microsoft Corporation. All rights reserved.
//
//---------------------------------------------------------------------------
using System;
using System.ComponentModel;
using System.Xml;
#if PBTCOMPILER
namespace MS.Internal.Markup
#else
namespace System.Windows.Markup
#endif
{
///TypeConverterContext class used for parsing Attributes.
internal class TypeConvertContext : ITypeDescriptorContext
{
#region Public
#region Methods
///
/// OnComponentChange
///
///
/// member is public only because base class has
/// this public member declared
///
///
/// void
///
public void OnComponentChanged()
{
}
///
/// OnComponentChanging
///
///
/// member is public only because base class has
/// this public member declared
///
///
/// void
///
public bool OnComponentChanging()
{
return false;
}
///
/// IServiceProvider GetService implementation
///
///
/// Type of Service to be returned
///
///
/// member is public only because base class has
/// this public member declared
///
///
/// Service object or null if service is not found
///
virtual public object GetService(Type serviceType)
{
if (serviceType == typeof(IUriContext))
{
return _parserContext as IUriContext;
}
// temporary code to optimize Paints.White etc, until this is done
// in a more generic fashion in SolidPaint ctor
else if (serviceType == typeof(string))
{
return _attribStringValue;
}
#if PBTCOMPILER
return null;
#else
// Check for the other provided services
ProvideValueServiceProvider serviceProvider = _parserContext.ProvideValueProvider;
return serviceProvider.GetService( serviceType );
#endif
}
#endregion Methods
#region Properties
///Container property
///
/// property is public only because base class has
/// this public property declared
///
public IContainer Container
{
get {return null;}
}
///Instance property
///
/// property is public only because base class has
/// this public property declared
///
public object Instance
{
get { return null; }
}
///Propert Descriptor
///
/// property is public only because base class has
/// this public property declared
///
public PropertyDescriptor PropertyDescriptor
{
get { return null;}
}
#if !PBTCOMPILER
// Make the ParserContext available internally as an optimization.
public ParserContext ParserContext
{
get { return _parserContext; }
}
#endif
#endregion Properties
#endregion Public
#region Internal
#region Contructors
#if !PBTCOMPILER
///
///
///
///
public TypeConvertContext(ParserContext parserContext)
{
_parserContext = parserContext;
}
#endif
// temporary code to optimize Paints.White etc, until this is done
// in a more generic fashion in SolidPaint ctor
#if PBTCOMPILER
///
///
///
///
///
public TypeConvertContext(ParserContext parserContext, string originalAttributeValue)
{
_parserContext = parserContext;
_attribStringValue = originalAttributeValue;
}
#endif
#endregion Constructors
#endregion internal
#region Private
#region Data
ParserContext _parserContext;
// _attribStringValue is never set when !PBTCOMPILER
#pragma warning disable 0649
string _attribStringValue;
#pragma warning restore 0649
#endregion Data
#endregion Private
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------------------
//
// File: typeContext.cs
//
// Description:
// class for the main TypeConverterContext object passed to type converters
//
//
// History:
// 8/02/01: rogerg Created
// 05/23/03: peterost Ported to wcp
//
// Copyright (C) 2001 by Microsoft Corporation. All rights reserved.
//
//---------------------------------------------------------------------------
using System;
using System.ComponentModel;
using System.Xml;
#if PBTCOMPILER
namespace MS.Internal.Markup
#else
namespace System.Windows.Markup
#endif
{
///TypeConverterContext class used for parsing Attributes.
internal class TypeConvertContext : ITypeDescriptorContext
{
#region Public
#region Methods
///
/// OnComponentChange
///
///
/// member is public only because base class has
/// this public member declared
///
///
/// void
///
public void OnComponentChanged()
{
}
///
/// OnComponentChanging
///
///
/// member is public only because base class has
/// this public member declared
///
///
/// void
///
public bool OnComponentChanging()
{
return false;
}
///
/// IServiceProvider GetService implementation
///
///
/// Type of Service to be returned
///
///
/// member is public only because base class has
/// this public member declared
///
///
/// Service object or null if service is not found
///
virtual public object GetService(Type serviceType)
{
if (serviceType == typeof(IUriContext))
{
return _parserContext as IUriContext;
}
// temporary code to optimize Paints.White etc, until this is done
// in a more generic fashion in SolidPaint ctor
else if (serviceType == typeof(string))
{
return _attribStringValue;
}
#if PBTCOMPILER
return null;
#else
// Check for the other provided services
ProvideValueServiceProvider serviceProvider = _parserContext.ProvideValueProvider;
return serviceProvider.GetService( serviceType );
#endif
}
#endregion Methods
#region Properties
///Container property
///
/// property is public only because base class has
/// this public property declared
///
public IContainer Container
{
get {return null;}
}
///Instance property
///
/// property is public only because base class has
/// this public property declared
///
public object Instance
{
get { return null; }
}
///Propert Descriptor
///
/// property is public only because base class has
/// this public property declared
///
public PropertyDescriptor PropertyDescriptor
{
get { return null;}
}
#if !PBTCOMPILER
// Make the ParserContext available internally as an optimization.
public ParserContext ParserContext
{
get { return _parserContext; }
}
#endif
#endregion Properties
#endregion Public
#region Internal
#region Contructors
#if !PBTCOMPILER
///
///
///
///
public TypeConvertContext(ParserContext parserContext)
{
_parserContext = parserContext;
}
#endif
// temporary code to optimize Paints.White etc, until this is done
// in a more generic fashion in SolidPaint ctor
#if PBTCOMPILER
///
///
///
///
///
public TypeConvertContext(ParserContext parserContext, string originalAttributeValue)
{
_parserContext = parserContext;
_attribStringValue = originalAttributeValue;
}
#endif
#endregion Constructors
#endregion internal
#region Private
#region Data
ParserContext _parserContext;
// _attribStringValue is never set when !PBTCOMPILER
#pragma warning disable 0649
string _attribStringValue;
#pragma warning restore 0649
#endregion Data
#endregion Private
}
}
// 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
- ValueTypeFixupInfo.cs
- RelatedImageListAttribute.cs
- HitTestWithGeometryDrawingContextWalker.cs
- GroupBoxRenderer.cs
- XmlSchemaChoice.cs
- WorkflowPersistenceService.cs
- WebPartCollection.cs
- RoleGroupCollection.cs
- MethodImplAttribute.cs
- BevelBitmapEffect.cs
- SymmetricAlgorithm.cs
- EnumConverter.cs
- DispatchChannelSink.cs
- ADMembershipUser.cs
- InsufficientMemoryException.cs
- ToolBarPanel.cs
- InstanceContext.cs
- TableHeaderCell.cs
- ControlIdConverter.cs
- Schema.cs
- ValidationPropertyAttribute.cs
- SecurityChannelFaultConverter.cs
- RuleSetBrowserDialog.cs
- Size3DValueSerializer.cs
- TextRangeEdit.cs
- Activator.cs
- Symbol.cs
- FunctionParameter.cs
- MessageSecurityVersionConverter.cs
- EncoderReplacementFallback.cs
- StringCollection.cs
- WindowsMenu.cs
- HttpListenerContext.cs
- WebPartsPersonalizationAuthorization.cs
- FormatConvertedBitmap.cs
- basecomparevalidator.cs
- DynamicDataExtensions.cs
- RemotingSurrogateSelector.cs
- DesignDataSource.cs
- WorkflowOperationBehavior.cs
- DecoderExceptionFallback.cs
- SimplePropertyEntry.cs
- XamlFilter.cs
- ControlParameter.cs
- UseLicense.cs
- ViewGenerator.cs
- PaginationProgressEventArgs.cs
- XmlSignatureManifest.cs
- precedingquery.cs
- DummyDataSource.cs
- Evaluator.cs
- EditCommandColumn.cs
- EntitySetBase.cs
- XmlEntityReference.cs
- CompositeTypefaceMetrics.cs
- TextTreeUndoUnit.cs
- IndicFontClient.cs
- MessageQueueCriteria.cs
- WindowsGraphicsCacheManager.cs
- _ProxyRegBlob.cs
- Group.cs
- SectionInformation.cs
- MessageAction.cs
- GridViewDeletedEventArgs.cs
- TextRunCacheImp.cs
- WindowsTitleBar.cs
- EdmToObjectNamespaceMap.cs
- AspNetHostingPermission.cs
- TypeReference.cs
- URLMembershipCondition.cs
- CodeExpressionRuleDeclaration.cs
- RewritingPass.cs
- ButtonStandardAdapter.cs
- ValidateNames.cs
- PeerContact.cs
- AccessDataSourceView.cs
- MergeLocalizationDirectives.cs
- SqlFacetAttribute.cs
- PhysicalFontFamily.cs
- EditingScope.cs
- XPathItem.cs
- KeyValuePair.cs
- PersonalizationProvider.cs
- WebEvents.cs
- Knowncolors.cs
- SqlDataSourceQueryEditorForm.cs
- ActivityCollectionMarkupSerializer.cs
- WebPartsPersonalizationAuthorization.cs
- StrokeNodeData.cs
- CommandValueSerializer.cs
- EnumMember.cs
- ServiceContractViewControl.cs
- HtmlSelectionListAdapter.cs
- MenuBase.cs
- elementinformation.cs
- ImpersonationContext.cs
- TraceProvider.cs
- PageRanges.cs
- AutomationPeer.cs
- SqlNotificationEventArgs.cs