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
- TileModeValidation.cs
- ColumnWidthChangedEvent.cs
- AppPool.cs
- OrderByExpression.cs
- FixedSOMImage.cs
- DBParameter.cs
- BooleanFacetDescriptionElement.cs
- FixedSOMPage.cs
- ClientSponsor.cs
- GeneralTransform3DTo2DTo3D.cs
- EUCJPEncoding.cs
- FamilyTypeface.cs
- ButtonRenderer.cs
- SpecialNameAttribute.cs
- UIElementCollection.cs
- SmtpFailedRecipientsException.cs
- SingleSelectRootGridEntry.cs
- SerializerProvider.cs
- X509KeyIdentifierClauseType.cs
- SQLBytesStorage.cs
- HwndPanningFeedback.cs
- AndCondition.cs
- Privilege.cs
- MexHttpBindingElement.cs
- TimeStampChecker.cs
- safelink.cs
- FixUp.cs
- EtwTrace.cs
- TriggerAction.cs
- ObjectListItem.cs
- ZipIOLocalFileBlock.cs
- RegexWriter.cs
- ContentElementAutomationPeer.cs
- SimpleFileLog.cs
- OdbcConnection.cs
- DataControlImageButton.cs
- DebugTracing.cs
- GeometryHitTestParameters.cs
- HtmlElementErrorEventArgs.cs
- TableHeaderCell.cs
- ColorContext.cs
- RootCodeDomSerializer.cs
- TypeDescriptionProviderAttribute.cs
- AutomationAttributeInfo.cs
- LocationSectionRecord.cs
- AnimationClock.cs
- DecodeHelper.cs
- ComMethodElement.cs
- ClientOptions.cs
- FunctionOverloadResolver.cs
- KeyGestureValueSerializer.cs
- TableFieldsEditor.cs
- QuaternionKeyFrameCollection.cs
- SoapMessage.cs
- Mapping.cs
- StringFreezingAttribute.cs
- ParseElement.cs
- FramingDecoders.cs
- VisualTarget.cs
- QilName.cs
- ImageFormatConverter.cs
- StateDesigner.LayoutSelectionGlyph.cs
- AdapterUtil.cs
- ETagAttribute.cs
- XmlBindingWorker.cs
- XmlHierarchyData.cs
- ObjectNavigationPropertyMapping.cs
- PageAsyncTaskManager.cs
- SBCSCodePageEncoding.cs
- xdrvalidator.cs
- SafeNativeMethodsOther.cs
- AdapterSwitches.cs
- EntitySqlQueryCacheKey.cs
- ListenerAdaptersInstallComponent.cs
- StickyNoteAnnotations.cs
- RC2.cs
- RelOps.cs
- SHA1Managed.cs
- NTAccount.cs
- CommonObjectSecurity.cs
- ParameterCollection.cs
- StyleHelper.cs
- XmlNamedNodeMap.cs
- Int32Animation.cs
- ColumnTypeConverter.cs
- ApplicationId.cs
- CorrelationInitializer.cs
- SlotInfo.cs
- DataTableReader.cs
- WebPartActionVerb.cs
- ButtonColumn.cs
- MessageHeaderDescriptionCollection.cs
- BitmapCacheBrush.cs
- SupportsEventValidationAttribute.cs
- KernelTypeValidation.cs
- CounterCreationData.cs
- RemoteWebConfigurationHost.cs
- DiagnosticTrace.cs
- FunctionImportMapping.cs
- MailDefinition.cs