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
- BinaryParser.cs
- ProvidersHelper.cs
- ObjectListDesigner.cs
- RtfControlWordInfo.cs
- XmlSchemaAppInfo.cs
- XmlCollation.cs
- RtfFormatStack.cs
- StdValidatorsAndConverters.cs
- ComponentManagerBroker.cs
- BindingUtils.cs
- Rotation3DAnimationUsingKeyFrames.cs
- TextDecorationLocationValidation.cs
- IdentifierCollection.cs
- DownloadProgressEventArgs.cs
- XsltConvert.cs
- ILGen.cs
- Registration.cs
- TextCollapsingProperties.cs
- InputBinding.cs
- DataSourceXmlSubItemAttribute.cs
- CustomValidator.cs
- ExpressionNode.cs
- SettingsPropertyIsReadOnlyException.cs
- BooleanAnimationBase.cs
- XmlSchemaComplexContentExtension.cs
- EntityDataSourceSelectingEventArgs.cs
- GridViewRowEventArgs.cs
- ObjectViewEntityCollectionData.cs
- SQLCharsStorage.cs
- ReflectionServiceProvider.cs
- DbConnectionStringCommon.cs
- mactripleDES.cs
- BooleanAnimationUsingKeyFrames.cs
- Int32CAMarshaler.cs
- ToolBarButton.cs
- ReceiveSecurityHeaderEntry.cs
- DynamicPropertyReader.cs
- JapaneseCalendar.cs
- ValidatedMobileControlConverter.cs
- ParameterModifier.cs
- Error.cs
- AuthenticatingEventArgs.cs
- AssociationProvider.cs
- RtfToXamlReader.cs
- TextAdaptor.cs
- DbgUtil.cs
- PeerNameRecord.cs
- FlowDocumentPage.cs
- XmlSchemaSimpleTypeRestriction.cs
- ArgumentNullException.cs
- GroupBox.cs
- PeerNearMe.cs
- PageThemeCodeDomTreeGenerator.cs
- SelectionRangeConverter.cs
- IDataContractSurrogate.cs
- DeobfuscatingStream.cs
- ServiceProviders.cs
- PageAsyncTaskManager.cs
- ServerIdentity.cs
- CompressedStack.cs
- SiteMapSection.cs
- ConfigurationValue.cs
- DiscoveryClientBindingElement.cs
- SafeNativeMethods.cs
- Calendar.cs
- TypedDatasetGenerator.cs
- InternalConfirm.cs
- Timeline.cs
- NumericUpDown.cs
- AuthenticationModuleElementCollection.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- PasswordBox.cs
- CodeEntryPointMethod.cs
- WebFormDesignerActionService.cs
- SchemaTableColumn.cs
- XmlText.cs
- ConstraintManager.cs
- DatagridviewDisplayedBandsData.cs
- SpellerError.cs
- StringToken.cs
- PersonalizationAdministration.cs
- TreeViewHitTestInfo.cs
- XamlToRtfWriter.cs
- BasicCommandTreeVisitor.cs
- RoleBoolean.cs
- ActiveXHost.cs
- HelpExampleGenerator.cs
- XsltOutput.cs
- ColorTypeConverter.cs
- XmlEnumAttribute.cs
- NavigationWindow.cs
- EntityModelBuildProvider.cs
- XmlTextReaderImpl.cs
- RemoteWebConfigurationHost.cs
- StandardCommands.cs
- GcHandle.cs
- COM2EnumConverter.cs
- GlobalEventManager.cs
- AnimationTimeline.cs
- basemetadatamappingvisitor.cs