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
- CallContext.cs
- AvTraceFormat.cs
- NameValuePermission.cs
- UnsupportedPolicyOptionsException.cs
- TextRenderer.cs
- SystemBrushes.cs
- ToolStripTextBox.cs
- StateRuntime.cs
- Utils.cs
- MetaTableHelper.cs
- regiisutil.cs
- OdbcCommandBuilder.cs
- HtmlImage.cs
- ResourceCodeDomSerializer.cs
- XmlDataImplementation.cs
- BoundField.cs
- EntityContainer.cs
- ReferencedCollectionType.cs
- TextViewBase.cs
- Closure.cs
- ProfileServiceManager.cs
- DocumentViewerConstants.cs
- ProgressiveCrcCalculatingStream.cs
- LocalIdCollection.cs
- BeginCreateSecurityTokenRequest.cs
- SkinBuilder.cs
- RepeaterItemCollection.cs
- DSGeneratorProblem.cs
- FrameworkContentElement.cs
- ScrollEvent.cs
- SpoolingTaskBase.cs
- CustomErrorsSection.cs
- DesignTimeParseData.cs
- CompoundFileDeflateTransform.cs
- TemplateLookupAction.cs
- SimpleApplicationHost.cs
- SmtpClient.cs
- ParsedAttributeCollection.cs
- PrintPreviewControl.cs
- XmlSchemaAnyAttribute.cs
- SoapAttributes.cs
- DeclarativeCatalogPart.cs
- DashStyle.cs
- TileBrush.cs
- XmlUrlResolver.cs
- SplineKeyFrames.cs
- CopyNodeSetAction.cs
- FlatButtonAppearance.cs
- CommonProperties.cs
- TransactionOptions.cs
- SelectionPatternIdentifiers.cs
- AnimationClockResource.cs
- SerializationBinder.cs
- Literal.cs
- DataGridTable.cs
- BrowserCapabilitiesFactory35.cs
- ISCIIEncoding.cs
- CSharpCodeProvider.cs
- HandleValueEditor.cs
- PointAnimation.cs
- Int32Converter.cs
- TextSchema.cs
- Lease.cs
- StorageAssociationTypeMapping.cs
- TypeBuilder.cs
- CqlParser.cs
- SqlConnectionStringBuilder.cs
- ProjectionPruner.cs
- WindowsNonControl.cs
- SafeEventLogWriteHandle.cs
- PointAnimationUsingKeyFrames.cs
- autovalidator.cs
- DocumentAutomationPeer.cs
- HostingEnvironmentSection.cs
- AssociationTypeEmitter.cs
- Transaction.cs
- RegistryKey.cs
- OperatingSystemVersionCheck.cs
- CatalogZoneBase.cs
- ButtonColumn.cs
- ApplicationSecurityManager.cs
- SatelliteContractVersionAttribute.cs
- ChildrenQuery.cs
- ToolStripDropDown.cs
- FileReservationCollection.cs
- GeneralTransform3DGroup.cs
- KnownTypes.cs
- CapabilitiesUse.cs
- TextSchema.cs
- ButtonFieldBase.cs
- FilteredAttributeCollection.cs
- XmlNamespaceManager.cs
- GenericTextProperties.cs
- BackgroundWorker.cs
- AttachedProperty.cs
- CancellationToken.cs
- WebContext.cs
- CounterSet.cs
- Stacktrace.cs
- FunctionUpdateCommand.cs