Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / System / Windows / Media / FontFamilyValueSerializer.cs / 1305600 / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SafeRightsManagementPubHandle.cs
- Point3DCollection.cs
- BodyWriter.cs
- SQLBoolean.cs
- ProcessModule.cs
- ExtendedTransformFactory.cs
- NodeFunctions.cs
- DataColumnMappingCollection.cs
- MimeBasePart.cs
- TripleDES.cs
- WhitespaceRuleReader.cs
- MeshGeometry3D.cs
- RuntimeConfigLKG.cs
- TemplateBuilder.cs
- ToolZone.cs
- ImageListUtils.cs
- HtmlTextArea.cs
- InputLangChangeEvent.cs
- documentsequencetextcontainer.cs
- dbdatarecord.cs
- ModuleElement.cs
- IndexedEnumerable.cs
- ApplicationId.cs
- WebProxyScriptElement.cs
- UserMapPath.cs
- DataGridViewRowHeightInfoNeededEventArgs.cs
- XmlSchemaAppInfo.cs
- StateRuntime.cs
- BookmarkScopeInfo.cs
- ContainerActivationHelper.cs
- Border.cs
- SecureStringHasher.cs
- AppDomainUnloadedException.cs
- XmlnsDictionary.cs
- ReachDocumentReferenceCollectionSerializerAsync.cs
- PropertyValueUIItem.cs
- DispatcherExceptionFilterEventArgs.cs
- ConditionalAttribute.cs
- ColumnResult.cs
- SQLByte.cs
- XmlRawWriter.cs
- PipelineModuleStepContainer.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- WSSecurityPolicy12.cs
- ThemeableAttribute.cs
- dtdvalidator.cs
- Environment.cs
- SizeLimitedCache.cs
- DataGridViewAutoSizeModeEventArgs.cs
- ColumnResult.cs
- DocumentPageTextView.cs
- HtmlElement.cs
- AuthenticationServiceManager.cs
- Activator.cs
- WorkflowPersistenceService.cs
- TreeViewItem.cs
- DataGridViewCellContextMenuStripNeededEventArgs.cs
- ConnectionManager.cs
- DmlSqlGenerator.cs
- XslCompiledTransform.cs
- MissingMemberException.cs
- CustomValidator.cs
- InputScopeAttribute.cs
- WebPartConnectionsCancelVerb.cs
- FrameDimension.cs
- EdmPropertyAttribute.cs
- FunctionQuery.cs
- ProtocolsSection.cs
- IpcChannel.cs
- LayoutEvent.cs
- ScriptModule.cs
- ResolveRequestResponseAsyncResult.cs
- EncodingInfo.cs
- CompoundFileReference.cs
- ObjectReaderCompiler.cs
- MaskInputRejectedEventArgs.cs
- HandlerBase.cs
- ActivityAction.cs
- DataGridAddNewRow.cs
- XmlSigningNodeWriter.cs
- DesignerActionService.cs
- HttpCookie.cs
- ListViewCommandEventArgs.cs
- ListBox.cs
- AnnotationService.cs
- AdPostCacheSubstitution.cs
- ContentControl.cs
- TreeNodeSelectionProcessor.cs
- dsa.cs
- RefreshPropertiesAttribute.cs
- CodeAccessPermission.cs
- GridEntry.cs
- CallTemplateAction.cs
- KnownTypeDataContractResolver.cs
- Rectangle.cs
- BatchParser.cs
- ProfileManager.cs
- ZipIOExtraFieldPaddingElement.cs
- RolePrincipal.cs
- SmtpAuthenticationManager.cs