Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Base / System / Windows / Markup / DateTimeConverter2.cs / 1 / 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
- EpmSourceTree.cs
- InArgument.cs
- EntityTypeEmitter.cs
- CatalogZoneDesigner.cs
- XmlSchemaIdentityConstraint.cs
- TextEditorContextMenu.cs
- VectorAnimationBase.cs
- Font.cs
- DesignerVerb.cs
- SchemaManager.cs
- XmlSchemaSubstitutionGroup.cs
- PrivateFontCollection.cs
- DataBindEngine.cs
- MSAANativeProvider.cs
- ListMarkerSourceInfo.cs
- EngineSiteSapi.cs
- GridViewAutomationPeer.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- ConsumerConnectionPoint.cs
- XpsSerializerWriter.cs
- ListViewGroupConverter.cs
- OneOf.cs
- AssemblyBuilderData.cs
- SponsorHelper.cs
- MemberProjectedSlot.cs
- SelectionItemPattern.cs
- SafeLocalMemHandle.cs
- XmlDocumentFragment.cs
- LocalClientSecuritySettingsElement.cs
- UrlMapping.cs
- RowParagraph.cs
- FormsAuthentication.cs
- XmlSchemaImport.cs
- CodeDOMProvider.cs
- LinkedList.cs
- AssociatedControlConverter.cs
- SystemResourceKey.cs
- WebBrowserDocumentCompletedEventHandler.cs
- UrlMapping.cs
- IntranetCredentialPolicy.cs
- CodeStatement.cs
- ExecutionEngineException.cs
- HelpFileFileNameEditor.cs
- LinqDataSourceValidationException.cs
- Peer.cs
- ArithmeticException.cs
- SmtpNegotiateAuthenticationModule.cs
- ACE.cs
- peernodestatemanager.cs
- TimeoutValidationAttribute.cs
- TempFiles.cs
- ConfigurationLocation.cs
- ObjectItemLoadingSessionData.cs
- Int32Collection.cs
- Pkcs7Recipient.cs
- SupportsPreviewControlAttribute.cs
- UrlRoutingModule.cs
- DataControlButton.cs
- EntityModelBuildProvider.cs
- SqlTriggerAttribute.cs
- FontDialog.cs
- TemplatePartAttribute.cs
- BitmapScalingModeValidation.cs
- CombinedHttpChannel.cs
- DataGrid.cs
- ErrorWebPart.cs
- ServerValidateEventArgs.cs
- MediaTimeline.cs
- ProgressiveCrcCalculatingStream.cs
- DbProviderFactory.cs
- XmlLinkedNode.cs
- UiaCoreApi.cs
- UIElementPropertyUndoUnit.cs
- WebPartCatalogAddVerb.cs
- Encoding.cs
- EasingKeyFrames.cs
- SQLResource.cs
- FlowDocumentView.cs
- ThreadStaticAttribute.cs
- DNS.cs
- RecordManager.cs
- ConfigurationPropertyCollection.cs
- SmtpClient.cs
- TableLayoutColumnStyleCollection.cs
- DATA_BLOB.cs
- DesignColumn.cs
- Geometry3D.cs
- CodeMemberEvent.cs
- XmlHelper.cs
- PassportAuthentication.cs
- ListItemParagraph.cs
- PrefixHandle.cs
- SafeFreeMibTable.cs
- SmtpAuthenticationManager.cs
- HtmlEmptyTagControlBuilder.cs
- FontCollection.cs
- FixedSOMTable.cs
- OleCmdHelper.cs
- DockAndAnchorLayout.cs
- JobStaple.cs