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
- entitydatasourceentitysetnameconverter.cs
- HtmlInputImage.cs
- Addressing.cs
- ellipse.cs
- ProcessDesigner.cs
- SplitterCancelEvent.cs
- IfAction.cs
- SqlErrorCollection.cs
- StringAnimationUsingKeyFrames.cs
- HuffmanTree.cs
- QilName.cs
- LinkedResourceCollection.cs
- TimeZone.cs
- RTTrackingProfile.cs
- XmlNavigatorFilter.cs
- ComponentFactoryHelpers.cs
- WebPart.cs
- QilTypeChecker.cs
- EditorPartChrome.cs
- WmpBitmapEncoder.cs
- CodeSnippetExpression.cs
- UriScheme.cs
- SQLDecimalStorage.cs
- CodeSnippetStatement.cs
- DetailsViewCommandEventArgs.cs
- ReceiveContextCollection.cs
- OdbcPermission.cs
- BasePattern.cs
- XmlReaderSettings.cs
- ConsumerConnectionPointCollection.cs
- ForeignKeyConstraint.cs
- ListBox.cs
- DBConnectionString.cs
- StatusBarPanelClickEvent.cs
- CatalogZone.cs
- SmtpMail.cs
- ConstructorNeedsTagAttribute.cs
- filewebrequest.cs
- LogPolicy.cs
- oledbconnectionstring.cs
- TimeSpanStorage.cs
- ConnectionConsumerAttribute.cs
- UserControlBuildProvider.cs
- AccessDataSourceView.cs
- _TransmitFileOverlappedAsyncResult.cs
- RemoteWebConfigurationHostServer.cs
- PrefixHandle.cs
- AbstractExpressions.cs
- SqlDataSourceEnumerator.cs
- DecoderReplacementFallback.cs
- TreeView.cs
- ToolboxComponentsCreatedEventArgs.cs
- HttpResponse.cs
- SocketPermission.cs
- InvalidWMPVersionException.cs
- Utils.cs
- DrawingContextDrawingContextWalker.cs
- RC2CryptoServiceProvider.cs
- CLSCompliantAttribute.cs
- InlinedLocationReference.cs
- ComIntegrationManifestGenerator.cs
- ExpressionConverter.cs
- ShutDownListener.cs
- IntegerValidatorAttribute.cs
- PerformanceCounterCategory.cs
- FileLoadException.cs
- CompositeDuplexElement.cs
- MetadataArtifactLoaderComposite.cs
- FrameworkEventSource.cs
- ChtmlTextWriter.cs
- DecoratedNameAttribute.cs
- IgnoreDeviceFilterElement.cs
- ApplicationProxyInternal.cs
- DataGridViewTopLeftHeaderCell.cs
- CheckoutException.cs
- KeyValuePairs.cs
- FilterQuery.cs
- Classification.cs
- DesignerAdapterUtil.cs
- TableItemProviderWrapper.cs
- Baml2006KnownTypes.cs
- MergeFailedEvent.cs
- LabelLiteral.cs
- GridViewRowPresenter.cs
- JsonMessageEncoderFactory.cs
- PermissionToken.cs
- MimePart.cs
- MailMessage.cs
- CodeDelegateCreateExpression.cs
- AnnotationStore.cs
- ContainerControl.cs
- Themes.cs
- CachedPathData.cs
- TransportChannelFactory.cs
- RuntimeHelpers.cs
- PTProvider.cs
- HtmlInputButton.cs
- GlyphRun.cs
- DragEventArgs.cs
- AssociationSetEnd.cs