Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / System / Windows / Input / MouseButton.cs / 1305600 / MouseButton.cs
using System; using MS.Internal.PresentationCore; namespace System.Windows.Input { ////// The MouseButton enumeration describes the buttons available on /// the mouse device. /// ////// You must update MouseButtonUtilities.Validate if any changes are made to this type /// public enum MouseButton { ////// The left mouse button. /// Left, ////// The middle mouse button. /// Middle, ////// The right mouse button. /// Right, ////// The fourth mouse button. /// XButton1, ////// The fifth mouse button. /// XButton2 } ////// Utility class for MouseButton /// internal sealed class MouseButtonUtilities { ////// Private placeholder constructor /// ////// There is present to supress the autogeneration of a public one, which /// triggers an FxCop violation, as this is an internal class that is never instantiated /// private MouseButtonUtilities() { } ////// Ensures MouseButton is set to a valid value. /// ////// There is a proscription against using Enum.IsDefined(). (it is slow) /// So we manually validate using a switch statement. /// [FriendAccessAllowed] internal static void Validate(MouseButton button) { switch(button) { case MouseButton.Left: case MouseButton.Middle: case MouseButton.Right: case MouseButton.XButton1: case MouseButton.XButton2: break; default: throw new System.ComponentModel.InvalidEnumArgumentException("button", (int)button, typeof(MouseButton)); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. using System; using MS.Internal.PresentationCore; namespace System.Windows.Input { ////// The MouseButton enumeration describes the buttons available on /// the mouse device. /// ////// You must update MouseButtonUtilities.Validate if any changes are made to this type /// public enum MouseButton { ////// The left mouse button. /// Left, ////// The middle mouse button. /// Middle, ////// The right mouse button. /// Right, ////// The fourth mouse button. /// XButton1, ////// The fifth mouse button. /// XButton2 } ////// Utility class for MouseButton /// internal sealed class MouseButtonUtilities { ////// Private placeholder constructor /// ////// There is present to supress the autogeneration of a public one, which /// triggers an FxCop violation, as this is an internal class that is never instantiated /// private MouseButtonUtilities() { } ////// Ensures MouseButton is set to a valid value. /// ////// There is a proscription against using Enum.IsDefined(). (it is slow) /// So we manually validate using a switch statement. /// [FriendAccessAllowed] internal static void Validate(MouseButton button) { switch(button) { case MouseButton.Left: case MouseButton.Middle: case MouseButton.Right: case MouseButton.XButton1: case MouseButton.XButton2: break; default: throw new System.ComponentModel.InvalidEnumArgumentException("button", (int)button, typeof(MouseButton)); } } } } // 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
- IsolationInterop.cs
- SerializableReadOnlyDictionary.cs
- ServiceDurableInstanceContextProvider.cs
- GeneratedContractType.cs
- Light.cs
- UrlPropertyAttribute.cs
- UrlPropertyAttribute.cs
- altserialization.cs
- StreamingContext.cs
- RestHandlerFactory.cs
- EntityProviderServices.cs
- StyleSheetRefUrlEditor.cs
- CaseStatementSlot.cs
- AppDomainGrammarProxy.cs
- Decimal.cs
- StreamSecurityUpgradeInitiatorAsyncResult.cs
- ModelEditingScope.cs
- TemplateBindingExtensionConverter.cs
- CommandManager.cs
- XmlNodeChangedEventManager.cs
- EncoderParameter.cs
- RoleServiceManager.cs
- LogReserveAndAppendState.cs
- CookieParameter.cs
- XmlDataDocument.cs
- XhtmlBasicLinkAdapter.cs
- Label.cs
- Header.cs
- DrawingContextWalker.cs
- ObjectTypeMapping.cs
- Frame.cs
- QilTargetType.cs
- Rect3D.cs
- ReturnValue.cs
- HttpClientCertificate.cs
- DataServices.cs
- RenderData.cs
- DesignerDataStoredProcedure.cs
- ImportedNamespaceContextItem.cs
- WebPartZoneAutoFormat.cs
- SchemaCollectionPreprocessor.cs
- TagMapInfo.cs
- XhtmlBasicPhoneCallAdapter.cs
- BitmapEffectInputConnector.cs
- DriveInfo.cs
- Normalization.cs
- ParserContext.cs
- MasterPageBuildProvider.cs
- Events.cs
- DeferrableContent.cs
- FixedTextContainer.cs
- StrokeCollectionConverter.cs
- DynamicResourceExtensionConverter.cs
- TextTreeTextNode.cs
- FillRuleValidation.cs
- DateTimeOffsetConverter.cs
- ElementMarkupObject.cs
- DragDropManager.cs
- CheckBox.cs
- DoubleConverter.cs
- WebBrowserDocumentCompletedEventHandler.cs
- IgnoreSectionHandler.cs
- SQLRoleProvider.cs
- SyndicationDeserializer.cs
- IPCCacheManager.cs
- BamlResourceDeserializer.cs
- wgx_commands.cs
- CompiledQueryCacheEntry.cs
- ClientReliableChannelBinder.cs
- StateDesigner.TransitionInfo.cs
- ObjectListComponentEditor.cs
- XmlAutoDetectWriter.cs
- Image.cs
- ClickablePoint.cs
- GrammarBuilderBase.cs
- FormsIdentity.cs
- ObjectViewFactory.cs
- CommandBindingCollection.cs
- PageBreakRecord.cs
- ImageField.cs
- KeyManager.cs
- ThreadExceptionEvent.cs
- ConstructorBuilder.cs
- ProjectedWrapper.cs
- DynamicUpdateCommand.cs
- SQLInt64.cs
- SelectionItemPattern.cs
- CqlLexer.cs
- ConfigurationLocationCollection.cs
- TextClipboardData.cs
- ChannelSinkStacks.cs
- XmlTextAttribute.cs
- TagPrefixInfo.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- Int16AnimationUsingKeyFrames.cs
- NumberFormatter.cs
- SmtpFailedRecipientsException.cs
- DBConnectionString.cs
- SerTrace.cs
- BookmarkEventArgs.cs