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
- DataServiceQuery.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- SqlWebEventProvider.cs
- XPathBinder.cs
- WebPartVerb.cs
- Panel.cs
- AsyncPostBackTrigger.cs
- Geometry.cs
- HttpWriter.cs
- FileDialogPermission.cs
- Component.cs
- DiscoveryClientProtocol.cs
- ImmutableObjectAttribute.cs
- ZoneButton.cs
- BridgeDataReader.cs
- IconBitmapDecoder.cs
- UIElementParagraph.cs
- TextDecorations.cs
- SqlDataSourceCache.cs
- TreeViewImageKeyConverter.cs
- WmlValidationSummaryAdapter.cs
- ObjectItemCollectionAssemblyCacheEntry.cs
- OutputChannel.cs
- RunInstallerAttribute.cs
- URI.cs
- UDPClient.cs
- ChangeDirector.cs
- WindowsIdentity.cs
- SettingsContext.cs
- CompatibleIComparer.cs
- EventBuilder.cs
- SchemaMerger.cs
- UdpUtility.cs
- DataGridViewCellLinkedList.cs
- RectangleGeometry.cs
- ListViewInsertedEventArgs.cs
- ConfigurationStrings.cs
- MulticastOption.cs
- DLinqDataModelProvider.cs
- basenumberconverter.cs
- QueueAccessMode.cs
- PeerObject.cs
- AttributeProviderAttribute.cs
- ProcessHostMapPath.cs
- WorkflowWebService.cs
- SingleAnimationUsingKeyFrames.cs
- ArrayExtension.cs
- ZoneIdentityPermission.cs
- ToolStripButton.cs
- Accessible.cs
- WebPartTracker.cs
- OraclePermissionAttribute.cs
- DataGridViewHeaderCell.cs
- ImageCollectionCodeDomSerializer.cs
- WebRequestModulesSection.cs
- PhysicalFontFamily.cs
- EnumValAlphaComparer.cs
- Geometry3D.cs
- OdbcConnectionFactory.cs
- BamlMapTable.cs
- SignerInfo.cs
- IgnoreFileBuildProvider.cs
- XmlSchemaComplexType.cs
- TypeGeneratedEventArgs.cs
- UIInitializationException.cs
- wgx_sdk_version.cs
- PathFigureCollectionValueSerializer.cs
- XhtmlStyleClass.cs
- WebUtil.cs
- ImageAnimator.cs
- WindowsSecurityTokenAuthenticator.cs
- SettingsPropertyCollection.cs
- COSERVERINFO.cs
- PrintDialog.cs
- FilteredXmlReader.cs
- PageSettings.cs
- PassportPrincipal.cs
- TextFormatterHost.cs
- KeyFrames.cs
- NameValueSectionHandler.cs
- MruCache.cs
- Tokenizer.cs
- AlphaSortedEnumConverter.cs
- OptionalMessageQuery.cs
- BaseCollection.cs
- ErrorHandler.cs
- DataReaderContainer.cs
- NegotiateStream.cs
- TimelineGroup.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- SkewTransform.cs
- DesignerCategoryAttribute.cs
- AllowedAudienceUriElementCollection.cs
- CryptographicAttribute.cs
- TextSelection.cs
- XmlDeclaration.cs
- CodeTypeDelegate.cs
- EntityDataSourceChangedEventArgs.cs
- TransformerTypeCollection.cs
- TextEditorThreadLocalStore.cs