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
- LayoutUtils.cs
- XmlMemberMapping.cs
- Byte.cs
- HierarchicalDataSourceControl.cs
- SqlNotificationRequest.cs
- assemblycache.cs
- WrappedKeySecurityToken.cs
- OleAutBinder.cs
- AsmxEndpointPickerExtension.cs
- DurableMessageDispatchInspector.cs
- ListViewGroupItemCollection.cs
- Base64Encoder.cs
- PropertyInfoSet.cs
- ToolStripSeparatorRenderEventArgs.cs
- ConvertersCollection.cs
- Shape.cs
- TextClipboardData.cs
- InstanceContextMode.cs
- NativeMethods.cs
- SqlProviderManifest.cs
- DropSource.cs
- AccessDataSourceView.cs
- PersonalizationStateInfo.cs
- SQLInt32.cs
- SqlBulkCopy.cs
- PeerResolverMode.cs
- LowerCaseStringConverter.cs
- BindingExpressionUncommonField.cs
- GlyphCache.cs
- XmlAggregates.cs
- CollectionEditVerbManager.cs
- DateTimePicker.cs
- TypedTableBase.cs
- ClientEventManager.cs
- BitmapEffectInputConnector.cs
- RichTextBoxConstants.cs
- Component.cs
- ArgumentOutOfRangeException.cs
- DataBoundControlParameterTarget.cs
- DataViewManager.cs
- EncodingDataItem.cs
- Sequence.cs
- DrawingVisual.cs
- XmlWellformedWriter.cs
- ConfigurationSchemaErrors.cs
- ImmComposition.cs
- OleDbParameter.cs
- Error.cs
- InfoCardRSAPKCS1KeyExchangeDeformatter.cs
- MonikerUtility.cs
- WindowsFont.cs
- Slider.cs
- AmbiguousMatchException.cs
- GridViewEditEventArgs.cs
- Serializer.cs
- Propagator.Evaluator.cs
- QilLiteral.cs
- TraceSource.cs
- SchemaNotation.cs
- ApplicationInterop.cs
- DispatcherOperation.cs
- ReflectionTypeLoadException.cs
- RefreshEventArgs.cs
- DebugView.cs
- SqlDataSourceConfigureFilterForm.cs
- StrongName.cs
- Parser.cs
- AddInAdapter.cs
- LogRestartAreaEnumerator.cs
- MessageEncodingBindingElementImporter.cs
- SoapInteropTypes.cs
- BitStack.cs
- ConfigurationErrorsException.cs
- ArgumentNullException.cs
- DateTimeStorage.cs
- SpellerError.cs
- AssemblyCacheEntry.cs
- XmlEntity.cs
- DataConnectionHelper.cs
- ComponentCache.cs
- FileSecurity.cs
- PropertyEmitterBase.cs
- StreamGeometry.cs
- AsyncPostBackTrigger.cs
- SqlConnectionPoolGroupProviderInfo.cs
- PageAsyncTaskManager.cs
- PageContentCollection.cs
- ItemDragEvent.cs
- SqlFunctions.cs
- BoolExpressionVisitors.cs
- ConfigUtil.cs
- ConnectionPoint.cs
- ScriptManager.cs
- CmsUtils.cs
- DES.cs
- WorkflowTerminatedException.cs
- Cursor.cs
- MetadataUtilsSmi.cs
- RuntimeIdentifierPropertyAttribute.cs
- DriveInfo.cs