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
- XmlSchemaAnnotation.cs
- ObjRef.cs
- DrawListViewColumnHeaderEventArgs.cs
- PointLightBase.cs
- MailBnfHelper.cs
- PipeStream.cs
- PrintDialog.cs
- PropertyEmitter.cs
- SchemaImporterExtension.cs
- CollectionView.cs
- GroupBoxRenderer.cs
- TemplateControl.cs
- DataSysAttribute.cs
- EnvironmentPermission.cs
- HttpHandlersSection.cs
- _FtpControlStream.cs
- TextBounds.cs
- TextHidden.cs
- HtmlContainerControl.cs
- CommandManager.cs
- PropertyStore.cs
- DataMisalignedException.cs
- SiteMapSection.cs
- ExpressionSelection.cs
- HttpCookie.cs
- IndependentlyAnimatedPropertyMetadata.cs
- GenericAuthenticationEventArgs.cs
- WebUtil.cs
- ComplexPropertyEntry.cs
- Trace.cs
- HtmlWindowCollection.cs
- List.cs
- WebConfigurationManager.cs
- _AuthenticationState.cs
- DataBindingExpressionBuilder.cs
- OdbcFactory.cs
- EntityCommandCompilationException.cs
- ComponentConverter.cs
- followingquery.cs
- TextSpan.cs
- IEnumerable.cs
- metadatamappinghashervisitor.hashsourcebuilder.cs
- MenuItemStyle.cs
- Binding.cs
- LinearGradientBrush.cs
- TraceLevelHelper.cs
- SectionVisual.cs
- DefaultCommandExtensionCallback.cs
- EditorZone.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- GlyphRunDrawing.cs
- TraversalRequest.cs
- FormsAuthenticationTicket.cs
- GraphicsState.cs
- CurrentTimeZone.cs
- backend.cs
- TraceListeners.cs
- Path.cs
- SerializerWriterEventHandlers.cs
- RunWorkerCompletedEventArgs.cs
- TemplateControl.cs
- ChildDocumentBlock.cs
- EmissiveMaterial.cs
- FileBasedResourceGroveler.cs
- BinaryObjectReader.cs
- TextContainerChangeEventArgs.cs
- HiddenFieldDesigner.cs
- ReadOnlyPropertyMetadata.cs
- SQLBinary.cs
- InputElement.cs
- CompoundFileIOPermission.cs
- QueryCursorEventArgs.cs
- TemplatePartAttribute.cs
- RangeValidator.cs
- GrabHandleGlyph.cs
- TraceContextEventArgs.cs
- BinaryObjectWriter.cs
- WinFormsUtils.cs
- ToolStripDropDownMenu.cs
- ZipIOCentralDirectoryBlock.cs
- WebPartsSection.cs
- SmiEventSink_DeferedProcessing.cs
- DirectoryObjectSecurity.cs
- GetKeyedHashRequest.cs
- UshortList2.cs
- DataFieldEditor.cs
- FileSecurity.cs
- CoTaskMemUnicodeSafeHandle.cs
- Point3DConverter.cs
- CompensationHandlingFilter.cs
- ObjectComplexPropertyMapping.cs
- Literal.cs
- NonDualMessageSecurityOverHttp.cs
- SynchronizedKeyedCollection.cs
- Selection.cs
- Queue.cs
- UserControlCodeDomTreeGenerator.cs
- AssemblyNameProxy.cs
- TempFiles.cs
- CacheMode.cs