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
- MetadataCache.cs
- XMLDiffLoader.cs
- CatalogPartCollection.cs
- Dispatcher.cs
- FixedDocumentPaginator.cs
- PreservationFileReader.cs
- AddressUtility.cs
- IndexedString.cs
- Dispatcher.cs
- DataGridViewCellLinkedList.cs
- FrameworkElementFactoryMarkupObject.cs
- ColumnWidthChangingEvent.cs
- TcpClientSocketManager.cs
- TextFragmentEngine.cs
- CoTaskMemHandle.cs
- Matrix.cs
- TextTreeText.cs
- EventItfInfo.cs
- QueryResultOp.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- ParameterRetriever.cs
- BridgeDataRecord.cs
- ObjectQueryProvider.cs
- CodeNamespaceImport.cs
- SpeechRecognitionEngine.cs
- DefaultValueAttribute.cs
- MeasureData.cs
- AdPostCacheSubstitution.cs
- StorageMappingItemCollection.cs
- ByteAnimation.cs
- InstanceDataCollectionCollection.cs
- Polyline.cs
- Queue.cs
- DBSchemaTable.cs
- activationcontext.cs
- ReadWriteObjectLock.cs
- XmlFormatReaderGenerator.cs
- ISSmlParser.cs
- DetailsViewRowCollection.cs
- ListViewItem.cs
- ClientScriptManager.cs
- DataGridTableCollection.cs
- PixelShader.cs
- ListBindingHelper.cs
- LocatorPart.cs
- SingleQueryOperator.cs
- PreProcessInputEventArgs.cs
- PinnedBufferMemoryStream.cs
- SqlDataSourceFilteringEventArgs.cs
- ConfigurationCollectionAttribute.cs
- SecurityResources.cs
- RsaKeyIdentifierClause.cs
- FullTrustAssembly.cs
- DataBinding.cs
- FullTextBreakpoint.cs
- ContainerParaClient.cs
- ObjectNotFoundException.cs
- JsonReader.cs
- ScriptControlManager.cs
- InternalBufferOverflowException.cs
- Pair.cs
- EdmItemCollection.cs
- UpdateProgress.cs
- DefaultBinder.cs
- Control.cs
- SubMenuStyleCollection.cs
- FamilyTypeface.cs
- AdornerPresentationContext.cs
- DataTable.cs
- DesignerActionUIService.cs
- HuffCodec.cs
- AlphabeticalEnumConverter.cs
- DatatypeImplementation.cs
- ToolboxDataAttribute.cs
- RemotingAttributes.cs
- DocumentReferenceCollection.cs
- SuppressIldasmAttribute.cs
- NullRuntimeConfig.cs
- MetadataItemSerializer.cs
- InkCanvas.cs
- HtmlElementErrorEventArgs.cs
- XmlBindingWorker.cs
- COM2DataTypeToManagedDataTypeConverter.cs
- DateTime.cs
- HtmlButton.cs
- Pair.cs
- OLEDB_Enum.cs
- DefaultValueMapping.cs
- _UncName.cs
- GlyphManager.cs
- XmlUtil.cs
- COM2AboutBoxPropertyDescriptor.cs
- BindUriHelper.cs
- ReadOnlyHierarchicalDataSourceView.cs
- MonitorWrapper.cs
- PeerNameResolver.cs
- PropertySourceInfo.cs
- RichTextBoxConstants.cs
- DrawingContextWalker.cs
- TypeLibConverter.cs