Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- StyleCollectionEditor.cs
- SqlConnection.cs
- SerializationFieldInfo.cs
- PriorityRange.cs
- HttpListenerRequest.cs
- ValidationPropertyAttribute.cs
- FrameworkObject.cs
- FeatureSupport.cs
- ConfigurationManagerInternalFactory.cs
- InlineCollection.cs
- BulletedListEventArgs.cs
- PageThemeBuildProvider.cs
- Int32RectConverter.cs
- DBConnection.cs
- AddInController.cs
- SimpleHandlerBuildProvider.cs
- TileModeValidation.cs
- TransactionFlowElement.cs
- QueryContinueDragEventArgs.cs
- RouteItem.cs
- FixedSOMTable.cs
- HttpModuleAction.cs
- FontSource.cs
- CrossSiteScriptingValidation.cs
- CompositionAdorner.cs
- ITreeGenerator.cs
- NativeWrapper.cs
- _ConnectStream.cs
- TextEditorTyping.cs
- FixedHighlight.cs
- SoapSchemaImporter.cs
- MarkupWriter.cs
- ResourceDictionaryCollection.cs
- FileEnumerator.cs
- InvokeGenerator.cs
- WebBrowserBase.cs
- Hyperlink.cs
- IpcManager.cs
- XmlNamespaceDeclarationsAttribute.cs
- WindowsAuthenticationModule.cs
- FlowPanelDesigner.cs
- _SslState.cs
- GridViewRowCollection.cs
- XmlUtf8RawTextWriter.cs
- _NegoState.cs
- BrushValueSerializer.cs
- OracleBoolean.cs
- StaticContext.cs
- KeyGesture.cs
- XmlAnyElementAttributes.cs
- EntityRecordInfo.cs
- IEnumerable.cs
- PersistenceTypeAttribute.cs
- XmlILStorageConverter.cs
- M3DUtil.cs
- DBPropSet.cs
- SecurityDescriptor.cs
- TraceListener.cs
- ApplicationFileParser.cs
- ToolStripDropDownMenu.cs
- UnsafeNativeMethods.cs
- WebZone.cs
- CollectionAdapters.cs
- DurableEnlistmentState.cs
- SemanticKeyElement.cs
- ImageBrush.cs
- CodePropertyReferenceExpression.cs
- LinkLabelLinkClickedEvent.cs
- PrintPageEvent.cs
- ClientSession.cs
- RefreshPropertiesAttribute.cs
- XmlSchemaAttributeGroup.cs
- SamlAssertionKeyIdentifierClause.cs
- File.cs
- RuntimeArgumentHandle.cs
- WindowsFormsSectionHandler.cs
- SendAgentStatusRequest.cs
- _AutoWebProxyScriptHelper.cs
- EndpointIdentity.cs
- WindowsGraphics.cs
- BeginEvent.cs
- Int64.cs
- ButtonAutomationPeer.cs
- SqlDesignerDataSourceView.cs
- TdsEnums.cs
- ServiceOperationListItemList.cs
- BuildProviderCollection.cs
- WindowsIdentity.cs
- IgnoreFileBuildProvider.cs
- ScaleTransform3D.cs
- Serializer.cs
- ServicePointManagerElement.cs
- QilReference.cs
- DynamicPropertyReader.cs
- EditorAttribute.cs
- Button.cs
- MbpInfo.cs
- CodeRemoveEventStatement.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- SelectionChangedEventArgs.cs