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
- UICuesEvent.cs
- VisualTreeUtils.cs
- LinqExpressionNormalizer.cs
- WindowsMenu.cs
- PageContentAsyncResult.cs
- DataGridViewTopLeftHeaderCell.cs
- Literal.cs
- SoapReflectionImporter.cs
- ClientRoleProvider.cs
- MetadataArtifactLoaderFile.cs
- ResourceWriter.cs
- X509Utils.cs
- TaskResultSetter.cs
- RequestResizeEvent.cs
- SkipStoryboardToFill.cs
- GenerateHelper.cs
- Visual3D.cs
- ListBox.cs
- Int32AnimationBase.cs
- LiteralDesigner.cs
- ContentValidator.cs
- KeyedHashAlgorithm.cs
- XsdValidatingReader.cs
- AutomationElement.cs
- NativeMethodsOther.cs
- FixedSOMImage.cs
- RadioButton.cs
- RawAppCommandInputReport.cs
- ReadOnlyHierarchicalDataSourceView.cs
- IdentifierService.cs
- SqlDataReader.cs
- _UriSyntax.cs
- HttpHandlersSection.cs
- BrowsableAttribute.cs
- KeyboardNavigation.cs
- ReferenceConverter.cs
- ZipIOExtraFieldElement.cs
- ManualWorkflowSchedulerService.cs
- BinaryObjectInfo.cs
- relpropertyhelper.cs
- NoneExcludedImageIndexConverter.cs
- ListViewContainer.cs
- SqlCacheDependencyDatabase.cs
- TextEditorDragDrop.cs
- NumberFunctions.cs
- XmlChildNodes.cs
- WriteFileContext.cs
- ActivitySurrogateSelector.cs
- XmlObjectSerializerWriteContextComplex.cs
- KeyPullup.cs
- DataTableExtensions.cs
- BuildManager.cs
- ipaddressinformationcollection.cs
- SafeMILHandle.cs
- CodePrimitiveExpression.cs
- OptimalTextSource.cs
- BufferedGraphicsManager.cs
- CheckBoxStandardAdapter.cs
- DictionaryEntry.cs
- PageSettings.cs
- UnsafeMethods.cs
- MenuBase.cs
- UpdatePanel.cs
- Funcletizer.cs
- PlainXmlSerializer.cs
- ErrorProvider.cs
- Int64Animation.cs
- ProcessThreadCollection.cs
- SQLString.cs
- PermissionListSet.cs
- XmlUtil.cs
- TableLayoutStyle.cs
- ProcessStartInfo.cs
- OleDbConnectionFactory.cs
- RawUIStateInputReport.cs
- GeneralTransform3D.cs
- TypeUnloadedException.cs
- RuntimeCompatibilityAttribute.cs
- WebPartTracker.cs
- DataGridHeaderBorder.cs
- OwnerDrawPropertyBag.cs
- SamlDoNotCacheCondition.cs
- Encoder.cs
- BlobPersonalizationState.cs
- ContextMenu.cs
- TraceInternal.cs
- UriTemplateQueryValue.cs
- ScrollEvent.cs
- Point3DCollection.cs
- Span.cs
- GenericTypeParameterBuilder.cs
- PlaceHolder.cs
- PatternMatcher.cs
- BulletedListEventArgs.cs
- SettingsBase.cs
- HandleExceptionArgs.cs
- UnauthorizedWebPart.cs
- RewritingProcessor.cs
- InternalBase.cs
- DiscoveryClientElement.cs