Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / wpf / src / Core / CSharp / System / Windows / Media / FontFamilyValueSerializer.cs / 1 / FontFamilyValueSerializer.cs
//+------------------------------------------------------------------------ // // Microsoft Windows Client Platform // Copyright (C) Microsoft Corporation, 2002 // // File: FontFamilyValueSerializer.cs // // Contents: FontFamilyValueSerializer implementation // // Created: 6-20-2005 Chuck Jazdzewski ([....]) // //----------------------------------------------------------------------- using System.ComponentModel; using System.Globalization; using System.Windows.Markup; // Allow suppression of presharp warnings #pragma warning disable 1634, 1691 namespace System.Windows.Media { ////// Serializer for a FontFamily /// public class FontFamilyValueSerializer: ValueSerializer { ////// Returns true. FontFamilyValueSerializer can always convert from a string. /// public override bool CanConvertFromString(string value, IValueSerializerContext context) { return true; } ////// Creates a FontFamily from a string /// public override object ConvertFromString(string value, IValueSerializerContext context) { if (string.IsNullOrEmpty(value)) { throw GetConvertFromException(value); } return new FontFamily(value); } ////// Returns true if the FontFamily is a named font family. /// public override bool CanConvertToString(object value, IValueSerializerContext context) { FontFamily fontFamily = value as FontFamily; // Suppress PRESharp warning that fontFamily can be null; apparently PRESharp // doesn't understand short circuit evaluation of operator &&. #pragma warning suppress 56506 return fontFamily != null && fontFamily.Source != null && fontFamily.Source.Length != 0; } ////// Converts a font family to a string. /// public override string ConvertToString(object value, IValueSerializerContext context) { FontFamily fontFamily = value as FontFamily; if (fontFamily == null || fontFamily.Source == null) throw GetConvertToException(value, typeof(string)); return fontFamily.Source; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //+------------------------------------------------------------------------ // // Microsoft Windows Client Platform // Copyright (C) Microsoft Corporation, 2002 // // File: FontFamilyValueSerializer.cs // // Contents: FontFamilyValueSerializer implementation // // Created: 6-20-2005 Chuck Jazdzewski ([....]) // //----------------------------------------------------------------------- using System.ComponentModel; using System.Globalization; using System.Windows.Markup; // Allow suppression of presharp warnings #pragma warning disable 1634, 1691 namespace System.Windows.Media { ////// Serializer for a FontFamily /// public class FontFamilyValueSerializer: ValueSerializer { ////// Returns true. FontFamilyValueSerializer can always convert from a string. /// public override bool CanConvertFromString(string value, IValueSerializerContext context) { return true; } ////// Creates a FontFamily from a string /// public override object ConvertFromString(string value, IValueSerializerContext context) { if (string.IsNullOrEmpty(value)) { throw GetConvertFromException(value); } return new FontFamily(value); } ////// Returns true if the FontFamily is a named font family. /// public override bool CanConvertToString(object value, IValueSerializerContext context) { FontFamily fontFamily = value as FontFamily; // Suppress PRESharp warning that fontFamily can be null; apparently PRESharp // doesn't understand short circuit evaluation of operator &&. #pragma warning suppress 56506 return fontFamily != null && fontFamily.Source != null && fontFamily.Source.Length != 0; } ////// Converts a font family to a string. /// public override string ConvertToString(object value, IValueSerializerContext context) { FontFamily fontFamily = value as FontFamily; if (fontFamily == null || fontFamily.Source == null) throw GetConvertToException(value, typeof(string)); return fontFamily.Source; } } } // 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
- RawStylusInputCustomDataList.cs
- VisualStyleTypesAndProperties.cs
- EncodingNLS.cs
- DynamicHyperLink.cs
- PropertyConverter.cs
- PackagePartCollection.cs
- SamlDelegatingWriter.cs
- XMLSyntaxException.cs
- BitmapEffectDrawingContent.cs
- ToolStripGrip.cs
- SerializationEventsCache.cs
- FlowDocument.cs
- IntegrationExceptionEventArgs.cs
- StateBag.cs
- UserControlAutomationPeer.cs
- SafeBuffer.cs
- FrameworkContentElement.cs
- XmlExtensionFunction.cs
- RectConverter.cs
- DataRecordInternal.cs
- KeyTimeConverter.cs
- ReadOnlyCollection.cs
- StateManager.cs
- DataStreamFromComStream.cs
- securitycriticaldata.cs
- AnonymousIdentificationModule.cs
- HybridDictionary.cs
- ContractTypeNameElement.cs
- TextDecorations.cs
- WebScriptMetadataMessage.cs
- SevenBitStream.cs
- RemotingConfigParser.cs
- LeaseManager.cs
- webeventbuffer.cs
- TerminateWorkflow.cs
- WindowsListViewItemStartMenu.cs
- Currency.cs
- State.cs
- _ShellExpression.cs
- BitmapEffectGeneralTransform.cs
- ArrayTypeMismatchException.cs
- CapabilitiesRule.cs
- TextChangedEventArgs.cs
- TaiwanCalendar.cs
- FastPropertyAccessor.cs
- MarshalDirectiveException.cs
- ISessionStateStore.cs
- SizeFConverter.cs
- SortedDictionary.cs
- CurrencyWrapper.cs
- DataRowCollection.cs
- InstancePersistenceException.cs
- ToolStripItemClickedEventArgs.cs
- MarkupExtensionParser.cs
- DocumentOrderComparer.cs
- LineSegment.cs
- Executor.cs
- WindowPatternIdentifiers.cs
- AsymmetricSignatureFormatter.cs
- GridViewRowPresenterBase.cs
- SessionEndedEventArgs.cs
- LogExtent.cs
- X509CertificateValidationMode.cs
- WebPartCloseVerb.cs
- BindingElement.cs
- Soap12ServerProtocol.cs
- CapabilitiesAssignment.cs
- UnmanagedBitmapWrapper.cs
- NavigatorInput.cs
- TreeNodeClickEventArgs.cs
- CheckStoreFileValidityRequest.cs
- ServicesUtilities.cs
- ElementProxy.cs
- AssemblyAssociatedContentFileAttribute.cs
- TcpTransportSecurity.cs
- MethodResolver.cs
- OutputCacheModule.cs
- ClientUrlResolverWrapper.cs
- BinaryCommonClasses.cs
- BitmapEffectOutputConnector.cs
- DefaultValueTypeConverter.cs
- ApplicationBuildProvider.cs
- MasterPageBuildProvider.cs
- ToolStripRenderEventArgs.cs
- ProcessModule.cs
- TextRangeSerialization.cs
- ClientBuildManagerTypeDescriptionProviderBridge.cs
- FormattedTextSymbols.cs
- StickyNoteContentControl.cs
- XmlILTrace.cs
- SecurityPolicySection.cs
- oledbmetadatacollectionnames.cs
- StoragePropertyMapping.cs
- HttpVersion.cs
- UniqueConstraint.cs
- SafeNativeMethods.cs
- DataReceivedEventArgs.cs
- QilStrConcat.cs
- RtfToXamlLexer.cs
- XmlDataSourceView.cs