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
- TagMapInfo.cs
- ServerIdentity.cs
- StoreAnnotationsMap.cs
- VisualState.cs
- SafeEventLogReadHandle.cs
- TitleStyle.cs
- ClientRuntimeConfig.cs
- TreeNodeCollection.cs
- ProfileSection.cs
- DataServiceHostWrapper.cs
- HandlerFactoryCache.cs
- FixedDocumentSequencePaginator.cs
- DataGridLinkButton.cs
- Image.cs
- DoWhileDesigner.xaml.cs
- EventManager.cs
- UrlAuthorizationModule.cs
- Group.cs
- ContentElementAutomationPeer.cs
- ConfigurationManagerHelper.cs
- AssemblyResourceLoader.cs
- NetworkInterface.cs
- ExceptionRoutedEventArgs.cs
- CodeFieldReferenceExpression.cs
- DbConnectionPoolCounters.cs
- DefaultEventAttribute.cs
- StringFormat.cs
- StorageAssociationTypeMapping.cs
- Stylus.cs
- TextEditorTyping.cs
- SettingsBase.cs
- Wizard.cs
- altserialization.cs
- AsymmetricSignatureFormatter.cs
- basenumberconverter.cs
- ProxyGenerationError.cs
- CheckBox.cs
- JoinCqlBlock.cs
- ChangeConflicts.cs
- StreamWithDictionary.cs
- Events.cs
- SortableBindingList.cs
- AutomationEvent.cs
- ReflectTypeDescriptionProvider.cs
- CodeSubDirectory.cs
- NTAccount.cs
- Point4DValueSerializer.cs
- OleCmdHelper.cs
- Line.cs
- PtsCache.cs
- HttpListenerRequest.cs
- SessionEndingEventArgs.cs
- RoutedEventConverter.cs
- DataBindingExpressionBuilder.cs
- WebFormDesignerActionService.cs
- DbConnectionHelper.cs
- WorkflowStateRollbackService.cs
- CatalogZone.cs
- ToolStripItemDataObject.cs
- StreamHelper.cs
- InternalCache.cs
- XsdBuilder.cs
- PageBuildProvider.cs
- CreateUserWizardStep.cs
- StickyNote.cs
- KnownColorTable.cs
- TextEffectCollection.cs
- XdrBuilder.cs
- Transactions.cs
- CodeDirectoryCompiler.cs
- SqlUserDefinedAggregateAttribute.cs
- EntityProviderFactory.cs
- SrgsElementFactory.cs
- SqlNode.cs
- TableRow.cs
- WebPartsPersonalization.cs
- ListenerServiceInstallComponent.cs
- RegexCharClass.cs
- DataKey.cs
- DbgUtil.cs
- ContentPropertyAttribute.cs
- DropAnimation.xaml.cs
- DbExpressionVisitor_TResultType.cs
- ToolStripGrip.cs
- GeneralTransform2DTo3D.cs
- ObservableDictionary.cs
- Focus.cs
- VersionedStreamOwner.cs
- ExtenderControl.cs
- Int16AnimationUsingKeyFrames.cs
- FormViewModeEventArgs.cs
- HttpApplication.cs
- ThrowHelper.cs
- AssertHelper.cs
- PropertyDescriptor.cs
- SystemPens.cs
- FileStream.cs
- WindowsFormsSynchronizationContext.cs
- CodeMemberField.cs
- MatchingStyle.cs