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
- Soap.cs
- FacetChecker.cs
- NavigationService.cs
- DockPanel.cs
- ApplicationServiceManager.cs
- ChtmlTextWriter.cs
- ModelTreeEnumerator.cs
- ScriptResourceInfo.cs
- BinHexEncoder.cs
- OleDbInfoMessageEvent.cs
- ReversePositionQuery.cs
- ThicknessAnimationBase.cs
- SamlAuthorityBinding.cs
- Input.cs
- EventLogPermissionEntryCollection.cs
- RunInstallerAttribute.cs
- ValidatingReaderNodeData.cs
- Assembly.cs
- AsymmetricSignatureDeformatter.cs
- PackageDigitalSignatureManager.cs
- UIElement.cs
- LowerCaseStringConverter.cs
- MenuCommandService.cs
- StringHandle.cs
- ConnectorDragDropGlyph.cs
- ReadOnlyCollectionBase.cs
- EncryptedPackage.cs
- DoubleAnimationClockResource.cs
- TextureBrush.cs
- ListBox.cs
- AmbientLight.cs
- HttpCookie.cs
- CodeNamespaceCollection.cs
- XmlSerializer.cs
- IndentedTextWriter.cs
- ToolStripDropDownClosingEventArgs.cs
- pingexception.cs
- ResourceType.cs
- ErrorFormatter.cs
- OleCmdHelper.cs
- LineBreak.cs
- Nullable.cs
- MailWebEventProvider.cs
- WebDisplayNameAttribute.cs
- WeakEventTable.cs
- ServiceNotStartedException.cs
- ProfilePropertySettingsCollection.cs
- UserNamePasswordValidationMode.cs
- AssemblyEvidenceFactory.cs
- BuildProviderCollection.cs
- CustomErrorsSectionWrapper.cs
- WindowsNonControl.cs
- ActivityContext.cs
- ContainerFilterService.cs
- BamlRecordWriter.cs
- TemplatedAdorner.cs
- BitmapEffectvisualstate.cs
- LineMetrics.cs
- DataBoundControlParameterTarget.cs
- WebControl.cs
- KeyboardInputProviderAcquireFocusEventArgs.cs
- GeneralTransform2DTo3DTo2D.cs
- MyContact.cs
- SortKey.cs
- WhileDesigner.cs
- FontStyles.cs
- XpsPackagingException.cs
- FieldMetadata.cs
- Tile.cs
- RequestResponse.cs
- OperationResponse.cs
- ButtonFlatAdapter.cs
- HierarchicalDataTemplate.cs
- BufferedGraphicsContext.cs
- WebBrowserPermission.cs
- StateChangeEvent.cs
- PageDeviceFont.cs
- WrapperSecurityCommunicationObject.cs
- RadioButton.cs
- ResourcesBuildProvider.cs
- AbsoluteQuery.cs
- StringPropertyBuilder.cs
- BasicDesignerLoader.cs
- StringDictionary.cs
- ContentDefinition.cs
- StateBag.cs
- Monitor.cs
- WindowInteractionStateTracker.cs
- DrawingVisual.cs
- GroupStyle.cs
- Zone.cs
- RecipientInfo.cs
- FormParameter.cs
- OdbcConnectionString.cs
- TextRangeBase.cs
- XmlSerializerFaultFormatter.cs
- SQLUtility.cs
- DataTableNewRowEvent.cs
- Win32Exception.cs
- _DynamicWinsockMethods.cs