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
- WindowsHyperlink.cs
- DbProviderFactory.cs
- ComPlusDiagnosticTraceRecords.cs
- SecurityChannelListener.cs
- StatusStrip.cs
- HttpRuntime.cs
- TypeExtensions.cs
- ISAPIApplicationHost.cs
- ScriptHandlerFactory.cs
- SafeLocalMemHandle.cs
- CompressEmulationStream.cs
- WorkflowRuntimeEndpoint.cs
- UICuesEvent.cs
- ObjectListItemCollection.cs
- RangeValidator.cs
- ILGenerator.cs
- StateItem.cs
- FontClient.cs
- DefaultTextStoreTextComposition.cs
- SignatureResourcePool.cs
- TraceContextRecord.cs
- ISAPIApplicationHost.cs
- BitmapMetadataBlob.cs
- DataStorage.cs
- DynamicMetaObject.cs
- DecoderExceptionFallback.cs
- ThemeableAttribute.cs
- SrgsRule.cs
- ConfigurationValue.cs
- AsymmetricSignatureFormatter.cs
- GlobalAllocSafeHandle.cs
- HttpCapabilitiesEvaluator.cs
- BypassElement.cs
- TextChangedEventArgs.cs
- SubclassTypeValidatorAttribute.cs
- CloudCollection.cs
- GridViewCancelEditEventArgs.cs
- FontSource.cs
- DataSourceView.cs
- SafeCertificateContext.cs
- Subtree.cs
- PackageRelationshipCollection.cs
- SmiContext.cs
- WeakReference.cs
- QuaternionAnimationBase.cs
- AmbientLight.cs
- ReadContentAsBinaryHelper.cs
- BooleanToVisibilityConverter.cs
- TimelineClockCollection.cs
- ObjectPersistData.cs
- FtpCachePolicyElement.cs
- ValueConversionAttribute.cs
- ReferenceService.cs
- SqlRecordBuffer.cs
- ManagementScope.cs
- CodeCommentStatementCollection.cs
- XmlUnspecifiedAttribute.cs
- TableLayoutColumnStyleCollection.cs
- CompilerGeneratedAttribute.cs
- PagesSection.cs
- CheckBoxStandardAdapter.cs
- XXXOnTypeBuilderInstantiation.cs
- TextPattern.cs
- Misc.cs
- JpegBitmapDecoder.cs
- WebExceptionStatus.cs
- RuntimeArgumentHandle.cs
- RemotingConfiguration.cs
- IIS7ConfigurationLoader.cs
- RuntimeHelpers.cs
- PolicyStatement.cs
- DrawListViewItemEventArgs.cs
- TimeZone.cs
- IRCollection.cs
- Root.cs
- CallSiteBinder.cs
- ConfigurationProviderException.cs
- TreeNodeStyle.cs
- Rotation3DAnimationUsingKeyFrames.cs
- MenuStrip.cs
- TimeSpanMinutesOrInfiniteConverter.cs
- SeekStoryboard.cs
- PartialTrustVisibleAssembliesSection.cs
- XmlSchemaAttribute.cs
- NotificationContext.cs
- GridLengthConverter.cs
- Light.cs
- Registry.cs
- Mapping.cs
- QuestionEventArgs.cs
- DragAssistanceManager.cs
- Activator.cs
- OracleMonthSpan.cs
- ViewgenContext.cs
- SqlTypeSystemProvider.cs
- CapabilitiesUse.cs
- ImageMap.cs
- VisualStateGroup.cs
- TemplatedWizardStep.cs
- SymbolPair.cs