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 / 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
- EnvelopedPkcs7.cs
- EventSinkActivityDesigner.cs
- ChtmlImageAdapter.cs
- XmlChildNodes.cs
- StringWriter.cs
- DataControlButton.cs
- PrintingPermission.cs
- StylusCaptureWithinProperty.cs
- SystemIPInterfaceProperties.cs
- TdsEnums.cs
- MetadataCacheItem.cs
- TextInfo.cs
- ColumnHeader.cs
- _OverlappedAsyncResult.cs
- DrawListViewColumnHeaderEventArgs.cs
- PackagingUtilities.cs
- WpfKnownMemberInvoker.cs
- TypeGeneratedEventArgs.cs
- SqlTriggerAttribute.cs
- DeclarationUpdate.cs
- FilterEventArgs.cs
- XmlQueryStaticData.cs
- PersonalizationProviderHelper.cs
- ValueTable.cs
- RegistryKey.cs
- InternalRelationshipCollection.cs
- UnionExpr.cs
- ProvidePropertyAttribute.cs
- WithStatement.cs
- SystemIPGlobalProperties.cs
- TimeManager.cs
- MailDefinition.cs
- MyContact.cs
- KerberosReceiverSecurityToken.cs
- HtmlGenericControl.cs
- DataError.cs
- XmlQualifiedNameTest.cs
- CellTreeNode.cs
- ScrollBarRenderer.cs
- FontWeights.cs
- WS2007FederationHttpBindingElement.cs
- XmlDataSourceNodeDescriptor.cs
- DataControlPagerLinkButton.cs
- LocalizationCodeDomSerializer.cs
- WindowsFormsSynchronizationContext.cs
- ClickablePoint.cs
- TaiwanLunisolarCalendar.cs
- BStrWrapper.cs
- SmtpAuthenticationManager.cs
- BitmapEffectDrawingContextState.cs
- ContentElementAutomationPeer.cs
- TextRangeEdit.cs
- CustomLineCap.cs
- SerializationSectionGroup.cs
- SerializationObjectManager.cs
- HwndProxyElementProvider.cs
- CompensateDesigner.cs
- TypeSystemProvider.cs
- DataGridViewCellCancelEventArgs.cs
- FontWeights.cs
- followingsibling.cs
- ConfigurationManagerInternalFactory.cs
- WebBrowser.cs
- SemanticTag.cs
- CultureNotFoundException.cs
- CodeParameterDeclarationExpression.cs
- FormViewDeletedEventArgs.cs
- InvalidOperationException.cs
- PropertiesTab.cs
- Rules.cs
- HttpListenerResponse.cs
- AlignmentYValidation.cs
- SingleBodyParameterMessageFormatter.cs
- ISAPIRuntime.cs
- TextElementEnumerator.cs
- WorkflowMarkupSerializer.cs
- XPathExpr.cs
- sqlmetadatafactory.cs
- SafePEFileHandle.cs
- ContractMapping.cs
- LocalizationParserHooks.cs
- Point.cs
- QuaternionRotation3D.cs
- SoapInteropTypes.cs
- HttpContext.cs
- Utility.cs
- PointAnimation.cs
- TextEndOfLine.cs
- ZipIOModeEnforcingStream.cs
- JulianCalendar.cs
- GeneralTransform.cs
- TransactionManager.cs
- EntityClassGenerator.cs
- HttpResponseInternalBase.cs
- ReceiveContent.cs
- SettingsPropertyIsReadOnlyException.cs
- DecimalConverter.cs
- SpellerInterop.cs
- PathSegment.cs
- Light.cs