Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Core / CSharp / System / Windows / Input / MouseButton.cs / 1 / 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
- ProcessManager.cs
- x509store.cs
- KeyedPriorityQueue.cs
- ReferenceEqualityComparer.cs
- Range.cs
- AttributeCollection.cs
- GroupItem.cs
- LiteralLink.cs
- WebMessageEncodingElement.cs
- OptimalTextSource.cs
- DurableTimerExtension.cs
- IPAddressCollection.cs
- ExpressionBuilderCollection.cs
- PolyBezierSegmentFigureLogic.cs
- Control.cs
- RepeatInfo.cs
- VBCodeProvider.cs
- NavigatorInput.cs
- CqlGenerator.cs
- PackageFilter.cs
- ErrorStyle.cs
- DeflateEmulationStream.cs
- ACL.cs
- AppDomainProtocolHandler.cs
- XmlWrappingWriter.cs
- DesignerForm.cs
- CalendarDesigner.cs
- wgx_exports.cs
- DbConnectionPoolIdentity.cs
- ResourceDescriptionAttribute.cs
- MemberAccessException.cs
- DataGridViewRowPostPaintEventArgs.cs
- PermissionToken.cs
- FrameworkElement.cs
- BlockUIContainer.cs
- TableLayoutSettingsTypeConverter.cs
- ConnectionManagementElement.cs
- ValidationManager.cs
- WSTrust.cs
- MetadataPropertyCollection.cs
- AsymmetricKeyExchangeFormatter.cs
- SecurityTokenValidationException.cs
- StringAnimationBase.cs
- IndentTextWriter.cs
- DocumentViewerBaseAutomationPeer.cs
- GatewayDefinition.cs
- ServiceThrottle.cs
- SelectionRangeConverter.cs
- SByteStorage.cs
- BuildProvider.cs
- XmlTextWriter.cs
- WrappedIUnknown.cs
- GridViewPageEventArgs.cs
- DiscardableAttribute.cs
- DataSourceSelectArguments.cs
- SmiEventSink_DeferedProcessing.cs
- XpsFilter.cs
- X509IssuerSerialKeyIdentifierClause.cs
- DataGridViewRowPrePaintEventArgs.cs
- unsafeIndexingFilterStream.cs
- RepeaterItemEventArgs.cs
- Registry.cs
- TableItemProviderWrapper.cs
- IsolatedStorage.cs
- RectIndependentAnimationStorage.cs
- MulticastNotSupportedException.cs
- SafeNativeMethods.cs
- EncodingInfo.cs
- TextServicesCompartmentContext.cs
- FontSourceCollection.cs
- ButtonChrome.cs
- CounterSample.cs
- DBConnection.cs
- EntityDataSourceReferenceGroup.cs
- ActivationServices.cs
- WarningException.cs
- Vector3D.cs
- GridViewItemAutomationPeer.cs
- AttachedPropertyBrowsableAttribute.cs
- CounterCreationData.cs
- XXXOnTypeBuilderInstantiation.cs
- XmlCDATASection.cs
- AnimationClockResource.cs
- SplitterCancelEvent.cs
- EdmRelationshipRoleAttribute.cs
- CompositeDataBoundControl.cs
- ScriptingWebServicesSectionGroup.cs
- MarkedHighlightComponent.cs
- UniqueID.cs
- DataTable.cs
- XmlEntityReference.cs
- ClickablePoint.cs
- HtmlHead.cs
- ScrollBarAutomationPeer.cs
- SpecularMaterial.cs
- ToolStripSplitStackLayout.cs
- ColorPalette.cs
- BufferBuilder.cs
- LocalIdKeyIdentifierClause.cs
- HttpServerChannel.cs