Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Base / System / Windows / Markup / DateTimeConverter2.cs / 1305600 / DateTimeConverter2.cs
/****************************************************************************\ * * File: DateTimeConverter2.cs * \***************************************************************************/ using System.ComponentModel; #if PBTCOMPILER namespace MS.Internal.Markup #else using System.Globalization; using System.Text; namespace System.Windows.Markup #endif { //+------------------------------------------------------------------------------------- // // DateTimeConverter2 // // This internal class simply wraps the DateTimeValueSerializer, to make it compatible with // internal code that expects a type converter. // //+------------------------------------------------------------------------------------- internal class DateTimeConverter2 : TypeConverter { #if !PBTCOMPILER public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { if (sourceType == typeof(string)) { return true; } return base.CanConvertFrom(context, sourceType); } public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { if (destinationType == typeof(string)) { return true; } return base.CanConvertTo(context, destinationType); } public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { return _dateTimeValueSerializer.ConvertFromString( value as string, _valueSerializerContext ); } public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType != null && value is DateTime) { _dateTimeValueSerializer.ConvertToString( value as string, _valueSerializerContext ); } return base.ConvertTo(context, culture, value, destinationType); } private DateTimeValueSerializer _dateTimeValueSerializer = new DateTimeValueSerializer(); private IValueSerializerContext _valueSerializerContext = new DateTimeValueSerializerContext(); #endif } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. /****************************************************************************\ * * File: DateTimeConverter2.cs * \***************************************************************************/ using System.ComponentModel; #if PBTCOMPILER namespace MS.Internal.Markup #else using System.Globalization; using System.Text; namespace System.Windows.Markup #endif { //+------------------------------------------------------------------------------------- // // DateTimeConverter2 // // This internal class simply wraps the DateTimeValueSerializer, to make it compatible with // internal code that expects a type converter. // //+------------------------------------------------------------------------------------- internal class DateTimeConverter2 : TypeConverter { #if !PBTCOMPILER public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { if (sourceType == typeof(string)) { return true; } return base.CanConvertFrom(context, sourceType); } public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { if (destinationType == typeof(string)) { return true; } return base.CanConvertTo(context, destinationType); } public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { return _dateTimeValueSerializer.ConvertFromString( value as string, _valueSerializerContext ); } public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType != null && value is DateTime) { _dateTimeValueSerializer.ConvertToString( value as string, _valueSerializerContext ); } return base.ConvertTo(context, culture, value, destinationType); } private DateTimeValueSerializer _dateTimeValueSerializer = new DateTimeValueSerializer(); private IValueSerializerContext _valueSerializerContext = new DateTimeValueSerializerContext(); #endif } } // 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
- OleDbConnectionFactory.cs
- RSAPKCS1SignatureFormatter.cs
- EntityDataSourceMemberPath.cs
- UTF32Encoding.cs
- ConstructorArgumentAttribute.cs
- _AutoWebProxyScriptEngine.cs
- assemblycache.cs
- ITreeGenerator.cs
- AstTree.cs
- Content.cs
- UserMapPath.cs
- IPAddressCollection.cs
- BorderGapMaskConverter.cs
- Command.cs
- TextEditorSelection.cs
- IRCollection.cs
- WindowsRichEditRange.cs
- XmlNamespaceMapping.cs
- TableRow.cs
- CfgParser.cs
- DeviceSpecificChoice.cs
- CqlWriter.cs
- FormsAuthenticationCredentials.cs
- AttributeProviderAttribute.cs
- ViewValidator.cs
- FieldDescriptor.cs
- HttpHeaderCollection.cs
- WebPartDisplayModeEventArgs.cs
- CodeAttributeArgument.cs
- HighContrastHelper.cs
- MessageSmuggler.cs
- FirstMatchCodeGroup.cs
- XmlException.cs
- XmlUrlEditor.cs
- handlecollector.cs
- SpotLight.cs
- XamlHostingSection.cs
- FtpRequestCacheValidator.cs
- Preprocessor.cs
- XmlElementAttributes.cs
- MouseActionValueSerializer.cs
- DesignerSelectionListAdapter.cs
- DurableInstanceProvider.cs
- SendKeys.cs
- PeerEndPoint.cs
- TraceInternal.cs
- StyleHelper.cs
- DebugHandleTracker.cs
- InfoCardAsymmetricCrypto.cs
- ScrollViewerAutomationPeer.cs
- BindingMemberInfo.cs
- TemplateBamlTreeBuilder.cs
- ObjectStateFormatter.cs
- ComponentDispatcherThread.cs
- HyperLinkField.cs
- CompositeTypefaceMetrics.cs
- DataGridViewCellValueEventArgs.cs
- ObjectMemberMapping.cs
- RunClient.cs
- SQLInt64Storage.cs
- WebBrowserNavigatingEventHandler.cs
- WorkflowInstance.cs
- RuleCache.cs
- Int32Rect.cs
- ScrollProviderWrapper.cs
- SqlConnectionPoolGroupProviderInfo.cs
- ContentValidator.cs
- ExpressionLexer.cs
- ObjectHandle.cs
- TempEnvironment.cs
- ObjectManager.cs
- ChangeNode.cs
- ConnectivityStatus.cs
- SchemeSettingElement.cs
- Translator.cs
- SyndicationCategory.cs
- CustomCategoryAttribute.cs
- StringInfo.cs
- XmlSchemaValidationException.cs
- WmlValidatorAdapter.cs
- TablePatternIdentifiers.cs
- UndoEngine.cs
- DeadCharTextComposition.cs
- MetadataItemCollectionFactory.cs
- LocalizableAttribute.cs
- DelegateHelpers.Generated.cs
- RegexNode.cs
- ELinqQueryState.cs
- RelationshipEndCollection.cs
- Timeline.cs
- PathSegmentCollection.cs
- NameValuePermission.cs
- FrameworkContextData.cs
- DataConnectionHelper.cs
- MarkupCompilePass2.cs
- ExceptQueryOperator.cs
- ServerIdentity.cs
- ImageField.cs
- ListChangedEventArgs.cs
- GradientStop.cs