Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Core / CSharp / System / Windows / Input / Command / KeyGestureValueSerializer.cs / 1 / KeyGestureValueSerializer.cs
//---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // // Description: KeyGestureValueSerializer - Serializes a KeyGesture // to and from a string // // // History: // 08/04/2005 : Chuck Jazdzewski - Created // //--------------------------------------------------------------------------- using System; using System.ComponentModel; // for TypeConverter using System.Globalization; // for CultureInfo using System.Windows; using System.Windows.Input; using System.Windows.Markup; #pragma warning disable 1634, 1691 // suppressing PreSharp warnings namespace System.Windows.Input { ////// KeyGestureValueSerializer - Converter class for serializing a KeyGesture /// public class KeyGestureValueSerializer : ValueSerializer { ////// CanConvertFromString() /// /// /// ////// public override bool CanConvertFromString(string value, IValueSerializerContext context) { return true; } /// /// CanConvertToString() /// /// /// ////// public override bool CanConvertToString(object value, IValueSerializerContext context) { KeyGesture keyGesture = value as KeyGesture; #pragma warning disable 6506 return (keyGesture != null) && ModifierKeysConverter.IsDefinedModifierKeys(keyGesture.Modifiers) && KeyGestureConverter.IsDefinedKey(keyGesture.Key); #pragma warning restore 6506 } /// /// ConvertFromString() /// /// /// ///public override object ConvertFromString(string value, IValueSerializerContext context) { TypeConverter converter = TypeDescriptor.GetConverter(typeof(KeyGesture)); if (converter != null) return converter.ConvertFromString(value); else return base.ConvertFromString(value, context); } /// /// ConvertToString() /// /// /// ///public override string ConvertToString(object value, IValueSerializerContext context) { TypeConverter converter = TypeDescriptor.GetConverter(typeof(KeyGesture)); if (converter != null) return converter.ConvertToInvariantString(value); else return base.ConvertToString(value, context); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //---------------------------------------------------------------------------- // // // Copyright (C) Microsoft Corporation. All rights reserved. // // // // Description: KeyGestureValueSerializer - Serializes a KeyGesture // to and from a string // // // History: // 08/04/2005 : Chuck Jazdzewski - Created // //--------------------------------------------------------------------------- using System; using System.ComponentModel; // for TypeConverter using System.Globalization; // for CultureInfo using System.Windows; using System.Windows.Input; using System.Windows.Markup; #pragma warning disable 1634, 1691 // suppressing PreSharp warnings namespace System.Windows.Input { ////// KeyGestureValueSerializer - Converter class for serializing a KeyGesture /// public class KeyGestureValueSerializer : ValueSerializer { ////// CanConvertFromString() /// /// /// ////// public override bool CanConvertFromString(string value, IValueSerializerContext context) { return true; } /// /// CanConvertToString() /// /// /// ////// public override bool CanConvertToString(object value, IValueSerializerContext context) { KeyGesture keyGesture = value as KeyGesture; #pragma warning disable 6506 return (keyGesture != null) && ModifierKeysConverter.IsDefinedModifierKeys(keyGesture.Modifiers) && KeyGestureConverter.IsDefinedKey(keyGesture.Key); #pragma warning restore 6506 } /// /// ConvertFromString() /// /// /// ///public override object ConvertFromString(string value, IValueSerializerContext context) { TypeConverter converter = TypeDescriptor.GetConverter(typeof(KeyGesture)); if (converter != null) return converter.ConvertFromString(value); else return base.ConvertFromString(value, context); } /// /// ConvertToString() /// /// /// ///public override string ConvertToString(object value, IValueSerializerContext context) { TypeConverter converter = TypeDescriptor.GetConverter(typeof(KeyGesture)); if (converter != null) return converter.ConvertToInvariantString(value); else return base.ConvertToString(value, context); } } } // 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
- TransportReplyChannelAcceptor.cs
- Logging.cs
- HttpConfigurationSystem.cs
- Sentence.cs
- Error.cs
- CaseStatementSlot.cs
- PathSegmentCollection.cs
- UriTemplateVariableQueryValue.cs
- TextEditorLists.cs
- UnknownBitmapDecoder.cs
- NativeMethods.cs
- Point3D.cs
- StylusLogic.cs
- Win32Exception.cs
- Authorization.cs
- ScriptingRoleServiceSection.cs
- DataGridTable.cs
- StateMachineDesignerPaint.cs
- AttachedPropertyBrowsableAttribute.cs
- SqlCacheDependencyDatabaseCollection.cs
- HuffModule.cs
- CapabilitiesSection.cs
- COM2ExtendedBrowsingHandler.cs
- PublisherIdentityPermission.cs
- ResponseBodyWriter.cs
- LocalizabilityAttribute.cs
- AutoCompleteStringCollection.cs
- PointConverter.cs
- WebServiceHostFactory.cs
- StorageMappingItemLoader.cs
- HwndProxyElementProvider.cs
- DES.cs
- SchemaImporterExtensionsSection.cs
- InlineCollection.cs
- EncodingInfo.cs
- CharAnimationBase.cs
- GPRECTF.cs
- PrimitiveType.cs
- LinqDataSourceUpdateEventArgs.cs
- BufferedStream.cs
- SchemaMapping.cs
- BypassElementCollection.cs
- PngBitmapDecoder.cs
- UserInitiatedNavigationPermission.cs
- DesignerWithHeader.cs
- Pkcs7Recipient.cs
- CompModSwitches.cs
- ConnectionPoint.cs
- DelegateSerializationHolder.cs
- FullTextBreakpoint.cs
- ComponentDispatcher.cs
- Application.cs
- TextViewBase.cs
- TreeView.cs
- BaseContextMenu.cs
- CorrelationManager.cs
- LocatorPart.cs
- RowToParametersTransformer.cs
- AlphabeticalEnumConverter.cs
- LineServicesRun.cs
- ConnectionsZone.cs
- SocketPermission.cs
- DrawToolTipEventArgs.cs
- PropertyContainer.cs
- TemplateInstanceAttribute.cs
- HttpCachePolicyElement.cs
- ScriptResourceInfo.cs
- ReversePositionQuery.cs
- XmlDigitalSignatureProcessor.cs
- MenuItemStyleCollection.cs
- TextPointerBase.cs
- AnnotationAuthorChangedEventArgs.cs
- Rotation3DKeyFrameCollection.cs
- DragSelectionMessageFilter.cs
- ChildrenQuery.cs
- ServiceContractViewControl.Designer.cs
- SplitContainer.cs
- ToolStripRendererSwitcher.cs
- ParallelTimeline.cs
- NativeMethods.cs
- COM2EnumConverter.cs
- RelationshipNavigation.cs
- ClientReliableChannelBinder.cs
- ColumnReorderedEventArgs.cs
- BuildProvider.cs
- FixedSOMTableCell.cs
- ClientFormsIdentity.cs
- LineVisual.cs
- TreePrinter.cs
- Point3DCollectionConverter.cs
- HttpHandlerAction.cs
- Exceptions.cs
- AppLevelCompilationSectionCache.cs
- SoapSchemaImporter.cs
- CmsUtils.cs
- StrokeRenderer.cs
- PieceNameHelper.cs
- WindowsGraphicsCacheManager.cs
- VBIdentifierName.cs
- ApplicationHost.cs