Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- BamlWriter.cs
- RsaKeyIdentifierClause.cs
- TrustLevel.cs
- AdvancedBindingPropertyDescriptor.cs
- OdbcRowUpdatingEvent.cs
- XmlArrayItemAttributes.cs
- File.cs
- StreamWithDictionary.cs
- SynchronizationLockException.cs
- TextServicesProperty.cs
- TailPinnedEventArgs.cs
- ModelUIElement3D.cs
- ExpressionConverter.cs
- SelectedDatesCollection.cs
- Setter.cs
- LookupBindingPropertiesAttribute.cs
- ProxyWebPartConnectionCollection.cs
- MulticastIPAddressInformationCollection.cs
- SmtpReplyReaderFactory.cs
- KeyTime.cs
- FullTextLine.cs
- LocalBuilder.cs
- NGCSerializationManagerAsync.cs
- MenuItemAutomationPeer.cs
- MimeMultiPart.cs
- DictionaryGlobals.cs
- UnsafeMethods.cs
- ListSurrogate.cs
- Material.cs
- CompiledRegexRunnerFactory.cs
- QuadraticBezierSegment.cs
- ListViewItem.cs
- ControlBuilderAttribute.cs
- ContentControl.cs
- SqlClientPermission.cs
- ResourcePermissionBase.cs
- DataRecordInfo.cs
- Emitter.cs
- CdpEqualityComparer.cs
- SystemIPInterfaceProperties.cs
- BuildProviderAppliesToAttribute.cs
- TextTreeTextNode.cs
- TextAdaptor.cs
- COM2AboutBoxPropertyDescriptor.cs
- ProvidePropertyAttribute.cs
- UpdateProgress.cs
- DebugInfo.cs
- XmlSchemaValidationException.cs
- TranslateTransform3D.cs
- PackagePart.cs
- ClickablePoint.cs
- SafeViewOfFileHandle.cs
- QueryHandler.cs
- ZoomPercentageConverter.cs
- HierarchicalDataBoundControlAdapter.cs
- HandlerFactoryCache.cs
- InvalidateEvent.cs
- UnauthorizedWebPart.cs
- DisplayNameAttribute.cs
- StickyNoteAnnotations.cs
- FlowchartDesigner.Helpers.cs
- ImageAutomationPeer.cs
- QilSortKey.cs
- XsdDuration.cs
- DbConnectionPoolGroup.cs
- RequestQueryProcessor.cs
- DataGridViewCellStateChangedEventArgs.cs
- DataObjectCopyingEventArgs.cs
- MediaPlayerState.cs
- clipboard.cs
- RegexWorker.cs
- Random.cs
- VisualCollection.cs
- MarshalByValueComponent.cs
- BindableTemplateBuilder.cs
- Volatile.cs
- StylusButtonCollection.cs
- MouseButtonEventArgs.cs
- LexicalChunk.cs
- XamlTypeMapperSchemaContext.cs
- GridViewUpdatedEventArgs.cs
- TimeSpanMinutesOrInfiniteConverter.cs
- dataprotectionpermission.cs
- WithParamAction.cs
- OdbcTransaction.cs
- WebServiceHandler.cs
- XComponentModel.cs
- ListViewSortEventArgs.cs
- TreeBuilderBamlTranslator.cs
- AssociationTypeEmitter.cs
- XmlDocument.cs
- StylusPlugInCollection.cs
- PathData.cs
- ping.cs
- TextEditorSpelling.cs
- DataSourceUtil.cs
- RuleProcessor.cs
- FileSystemInfo.cs
- MetabaseSettings.cs
- RepeatButton.cs