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
- Stylesheet.cs
- Size3D.cs
- DataErrorValidationRule.cs
- HyperLinkField.cs
- _BasicClient.cs
- FunctionCommandText.cs
- BasicViewGenerator.cs
- PolicyException.cs
- WindowsProgressbar.cs
- FlowLayoutSettings.cs
- CompoundFileDeflateTransform.cs
- GPRECTF.cs
- NamespaceQuery.cs
- SuppressMessageAttribute.cs
- RequestTimeoutManager.cs
- FastEncoderStatics.cs
- EventDrivenDesigner.cs
- ProfileParameter.cs
- EllipticalNodeOperations.cs
- ExpressionNormalizer.cs
- StringBuilder.cs
- UserControlParser.cs
- NavigatorOutput.cs
- OdbcInfoMessageEvent.cs
- ReceiveMessageContent.cs
- SoapIgnoreAttribute.cs
- ErrorWebPart.cs
- WindowsFormsEditorServiceHelper.cs
- ChangeDirector.cs
- NonVisualControlAttribute.cs
- WebRequestModuleElementCollection.cs
- ComUdtElement.cs
- SynchronousChannelMergeEnumerator.cs
- XmlSchemaElement.cs
- TextInfo.cs
- AttributeConverter.cs
- TextContainerHelper.cs
- NumericPagerField.cs
- SoapMessage.cs
- PrimarySelectionGlyph.cs
- CodeGeneratorOptions.cs
- WebSysDefaultValueAttribute.cs
- Context.cs
- StringComparer.cs
- SqlColumnizer.cs
- SQLBinary.cs
- ResourceKey.cs
- IListConverters.cs
- DesignBindingPropertyDescriptor.cs
- XhtmlBasicListAdapter.cs
- PromptStyle.cs
- TiffBitmapDecoder.cs
- Calendar.cs
- Trigger.cs
- OleDbParameter.cs
- WsdlHelpGeneratorElement.cs
- VectorCollectionConverter.cs
- DesignerHost.cs
- RemotingConfiguration.cs
- ScrollViewerAutomationPeer.cs
- RoutedEventHandlerInfo.cs
- SemaphoreFullException.cs
- DataReceivedEventArgs.cs
- Timer.cs
- BamlWriter.cs
- PagePropertiesChangingEventArgs.cs
- RolePrincipal.cs
- ObjectNotFoundException.cs
- HtmlHead.cs
- UTF32Encoding.cs
- ApplicationId.cs
- SQLByteStorage.cs
- FakeModelPropertyImpl.cs
- XmlElementCollection.cs
- EntryPointNotFoundException.cs
- PointConverter.cs
- CodeGotoStatement.cs
- Inline.cs
- DependencyObjectProvider.cs
- StringUtil.cs
- ResourceExpressionBuilder.cs
- XamlRtfConverter.cs
- ProxyWebPartManager.cs
- MsdtcWrapper.cs
- SmtpFailedRecipientsException.cs
- WindowsStatic.cs
- wgx_commands.cs
- SystemFonts.cs
- SizeChangedInfo.cs
- UnsafeCollabNativeMethods.cs
- DataContract.cs
- DbConnectionPool.cs
- ObjectSpanRewriter.cs
- GridViewUpdateEventArgs.cs
- IdentityHolder.cs
- CopyOnWriteList.cs
- RequestQueue.cs
- Executor.cs
- ExtenderHelpers.cs
- PartialCachingControl.cs