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
- AggregateException.cs
- InvokeGenerator.cs
- LinkClickEvent.cs
- TextContainerChangeEventArgs.cs
- DataServiceProcessingPipelineEventArgs.cs
- TrackingLocationCollection.cs
- Rotation3DAnimationBase.cs
- AppSettingsExpressionBuilder.cs
- Timer.cs
- WorkflowApplicationUnhandledExceptionEventArgs.cs
- sqlpipe.cs
- DatePicker.cs
- MetadataItem.cs
- KeyBinding.cs
- Rotation3DAnimationBase.cs
- SchemaImporterExtensionElement.cs
- SoapSchemaExporter.cs
- BamlMapTable.cs
- AsyncResult.cs
- StylusButton.cs
- HtmlTableRowCollection.cs
- ReaderWriterLockSlim.cs
- CacheMemory.cs
- SecurityTokenException.cs
- SecurityDocument.cs
- AdapterDictionary.cs
- IdnElement.cs
- SqlCacheDependency.cs
- EventLogger.cs
- DefaultEventAttribute.cs
- ResourceExpressionEditor.cs
- SqlCacheDependencyDatabase.cs
- EmissiveMaterial.cs
- StateChangeEvent.cs
- DataViewManager.cs
- NetSectionGroup.cs
- TextProviderWrapper.cs
- CodeDelegateCreateExpression.cs
- TypeSemantics.cs
- PartialArray.cs
- ControlSerializer.cs
- PropertyIdentifier.cs
- ThreadPool.cs
- _Win32.cs
- HtmlElementErrorEventArgs.cs
- ChtmlMobileTextWriter.cs
- FixedFindEngine.cs
- Attribute.cs
- Util.cs
- Table.cs
- SvcFileManager.cs
- TypeDelegator.cs
- TreeNodeCollection.cs
- SettingsPropertyWrongTypeException.cs
- NumericUpDown.cs
- HtmlInputImage.cs
- ExpressionsCollectionConverter.cs
- CommonDialog.cs
- XmlSchemaInclude.cs
- Int32CollectionValueSerializer.cs
- TableStyle.cs
- DataBindingHandlerAttribute.cs
- FormsAuthenticationUserCollection.cs
- PerformanceCounterPermissionEntry.cs
- InstanceDataCollectionCollection.cs
- LocationUpdates.cs
- AutomationEventArgs.cs
- ApplicationBuildProvider.cs
- CodeSnippetTypeMember.cs
- MSAANativeProvider.cs
- ZipFileInfoCollection.cs
- Point3DAnimationUsingKeyFrames.cs
- AssemblyHash.cs
- ContentDisposition.cs
- EnterpriseServicesHelper.cs
- DBConcurrencyException.cs
- OptimizerPatterns.cs
- ProcessModelSection.cs
- EventLogger.cs
- OdbcUtils.cs
- PriorityQueue.cs
- InternalException.cs
- DesignerLabelAdapter.cs
- MenuItemCollection.cs
- DataGridViewControlCollection.cs
- LinkClickEvent.cs
- FacetValueContainer.cs
- RegexFCD.cs
- DetailsViewUpdatedEventArgs.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- PlainXmlDeserializer.cs
- JsonCollectionDataContract.cs
- SecurityException.cs
- ApplicationSecurityManager.cs
- Border.cs
- ComboBoxAutomationPeer.cs
- FieldValue.cs
- CultureInfoConverter.cs
- VisualProxy.cs
- WindowsGraphics2.cs