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
- ProfessionalColorTable.cs
- COAUTHINFO.cs
- XPathNode.cs
- RowType.cs
- ListControlConvertEventArgs.cs
- CodeDomLoader.cs
- IncomingWebRequestContext.cs
- UndirectedGraph.cs
- TdsParser.cs
- DatagridviewDisplayedBandsData.cs
- XmlSerializerFormatAttribute.cs
- BasicHttpBinding.cs
- WindowAutomationPeer.cs
- ActivityDesignerAccessibleObject.cs
- LinkClickEvent.cs
- BuildProviderCollection.cs
- MdImport.cs
- UmAlQuraCalendar.cs
- ContainerParagraph.cs
- PostBackOptions.cs
- RenderingEventArgs.cs
- MappingSource.cs
- WindowsListViewItem.cs
- CodeTypeReferenceExpression.cs
- ColumnReorderedEventArgs.cs
- UniqueIdentifierService.cs
- SectionUpdates.cs
- LineInfo.cs
- ThicknessAnimationUsingKeyFrames.cs
- ComplusEndpointConfigContainer.cs
- AdvancedBindingPropertyDescriptor.cs
- Point3DAnimationBase.cs
- CompilationUtil.cs
- DesignerOptionService.cs
- MessageSecurityException.cs
- InvalidOperationException.cs
- SatelliteContractVersionAttribute.cs
- FrameworkElementAutomationPeer.cs
- PrintDialog.cs
- BitStack.cs
- InkCanvasSelectionAdorner.cs
- ErrorEventArgs.cs
- SslStream.cs
- DiscoveryOperationContextExtension.cs
- securitycriticaldata.cs
- ActivityExecutorOperation.cs
- OdbcConnectionString.cs
- CodeTypeDeclaration.cs
- ClassData.cs
- MexHttpsBindingElement.cs
- cryptoapiTransform.cs
- WebPartConnectionsConnectVerb.cs
- LogicalExpressionEditor.cs
- XmlSerializerAssemblyAttribute.cs
- Calendar.cs
- ResourceDictionary.cs
- PointCollection.cs
- SelectionItemPattern.cs
- DictionaryManager.cs
- ControlPager.cs
- FlowLayout.cs
- loginstatus.cs
- DefinitionUpdate.cs
- BamlResourceDeserializer.cs
- CustomAttribute.cs
- XPathSelfQuery.cs
- AppDomainUnloadedException.cs
- DataGridViewSelectedRowCollection.cs
- AndMessageFilterTable.cs
- SimpleWebHandlerParser.cs
- FileLoadException.cs
- ReflectEventDescriptor.cs
- TextBoxRenderer.cs
- MemberAccessException.cs
- BuildProvider.cs
- Misc.cs
- XPathMultyIterator.cs
- PenContext.cs
- HwndKeyboardInputProvider.cs
- StrokeCollectionDefaultValueFactory.cs
- SharedPerformanceCounter.cs
- WriteableOnDemandPackagePart.cs
- AssociationSet.cs
- BitmapFrame.cs
- DispatcherEventArgs.cs
- RecognizerInfo.cs
- ComponentEditorForm.cs
- AuthenticatingEventArgs.cs
- WindowsFormsSynchronizationContext.cs
- KeyTime.cs
- UnlockInstanceCommand.cs
- Stylesheet.cs
- CellTreeNode.cs
- SubMenuStyleCollection.cs
- CardSpacePolicyElement.cs
- RangeBaseAutomationPeer.cs
- ResizeGrip.cs
- SocketElement.cs
- LockedAssemblyCache.cs
- EntityDataSourceWizardForm.cs