Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / System / Windows / Input / ManipulationCompletedEventArgs.cs / 1305600 / ManipulationCompletedEventArgs.cs
//---------------------------------------------------------------------------- // // Copyright (C) Microsoft Corporation. All rights reserved. // //--------------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Diagnostics; using System.Security; using System.Windows; using System.Windows.Media; namespace System.Windows.Input { ////// Provides information about the end of a manipulation. /// public sealed class ManipulationCompletedEventArgs : InputEventArgs { ////// Instantiates a new instance of this class. /// internal ManipulationCompletedEventArgs( ManipulationDevice manipulationDevice, int timestamp, IInputElement manipulationContainer, Point origin, ManipulationDelta total, ManipulationVelocities velocities, bool isInertial) : base(manipulationDevice, timestamp) { if (total == null) { throw new ArgumentNullException("total"); } if (velocities == null) { throw new ArgumentNullException("velocities"); } RoutedEvent = Manipulation.ManipulationCompletedEvent; ManipulationContainer = manipulationContainer; ManipulationOrigin = origin; TotalManipulation = total; FinalVelocities = velocities; IsInertial = isInertial; } ////// Invokes a handler of this event. /// protected override void InvokeEventHandler(Delegate genericHandler, object genericTarget) { if (genericHandler == null) { throw new ArgumentNullException("genericHandler"); } if (genericTarget == null) { throw new ArgumentNullException("genericTarget"); } if (RoutedEvent == Manipulation.ManipulationCompletedEvent) { ((EventHandler)genericHandler)(genericTarget, this); } else { base.InvokeEventHandler(genericHandler, genericTarget); } } /// /// Whether the event was generated due to inertia. /// public bool IsInertial { get; private set; } ////// Defines the coordinate space of the other properties. /// public IInputElement ManipulationContainer { get; private set; } ////// Returns the value of the origin. /// public Point ManipulationOrigin { get; private set; } ////// Returns the cumulative transformation associated with the manipulation. /// public ManipulationDelta TotalManipulation { get; private set; } ////// Returns the current velocities associated with a manipulation. /// public ManipulationVelocities FinalVelocities { get; private set; } ////// Method to cancel the Manipulation /// ///A bool indicating the success of Cancel public bool Cancel() { if (!IsInertial) { RequestedCancel = true; return true; } return false; } ////// A handler Requested to cancel the Manipulation /// internal bool RequestedCancel { get; private set; } ////// The Manipulators for this manipulation. /// public IEnumerableManipulators { get { if (_manipulators == null) { _manipulators = ((ManipulationDevice)Device).GetManipulatorsReadOnly(); } return _manipulators; } } private IEnumerable _manipulators; } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //---------------------------------------------------------------------------- // // Copyright (C) Microsoft Corporation. All rights reserved. // //--------------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Diagnostics; using System.Security; using System.Windows; using System.Windows.Media; namespace System.Windows.Input { /// /// Provides information about the end of a manipulation. /// public sealed class ManipulationCompletedEventArgs : InputEventArgs { ////// Instantiates a new instance of this class. /// internal ManipulationCompletedEventArgs( ManipulationDevice manipulationDevice, int timestamp, IInputElement manipulationContainer, Point origin, ManipulationDelta total, ManipulationVelocities velocities, bool isInertial) : base(manipulationDevice, timestamp) { if (total == null) { throw new ArgumentNullException("total"); } if (velocities == null) { throw new ArgumentNullException("velocities"); } RoutedEvent = Manipulation.ManipulationCompletedEvent; ManipulationContainer = manipulationContainer; ManipulationOrigin = origin; TotalManipulation = total; FinalVelocities = velocities; IsInertial = isInertial; } ////// Invokes a handler of this event. /// protected override void InvokeEventHandler(Delegate genericHandler, object genericTarget) { if (genericHandler == null) { throw new ArgumentNullException("genericHandler"); } if (genericTarget == null) { throw new ArgumentNullException("genericTarget"); } if (RoutedEvent == Manipulation.ManipulationCompletedEvent) { ((EventHandler)genericHandler)(genericTarget, this); } else { base.InvokeEventHandler(genericHandler, genericTarget); } } /// /// Whether the event was generated due to inertia. /// public bool IsInertial { get; private set; } ////// Defines the coordinate space of the other properties. /// public IInputElement ManipulationContainer { get; private set; } ////// Returns the value of the origin. /// public Point ManipulationOrigin { get; private set; } ////// Returns the cumulative transformation associated with the manipulation. /// public ManipulationDelta TotalManipulation { get; private set; } ////// Returns the current velocities associated with a manipulation. /// public ManipulationVelocities FinalVelocities { get; private set; } ////// Method to cancel the Manipulation /// ///A bool indicating the success of Cancel public bool Cancel() { if (!IsInertial) { RequestedCancel = true; return true; } return false; } ////// A handler Requested to cancel the Manipulation /// internal bool RequestedCancel { get; private set; } ////// The Manipulators for this manipulation. /// public IEnumerableManipulators { get { if (_manipulators == null) { _manipulators = ((ManipulationDevice)Device).GetManipulatorsReadOnly(); } return _manipulators; } } private IEnumerable _manipulators; } } // 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
- DataTableNewRowEvent.cs
- NetCodeGroup.cs
- CodeCommentStatementCollection.cs
- RequestCachePolicy.cs
- BooleanStorage.cs
- TextBox.cs
- _ContextAwareResult.cs
- SiteOfOriginPart.cs
- UIElementCollection.cs
- StringComparer.cs
- ExpressionList.cs
- ElementHostAutomationPeer.cs
- StylusDownEventArgs.cs
- safex509handles.cs
- BitHelper.cs
- DbConnectionClosed.cs
- IDispatchConstantAttribute.cs
- Visual3D.cs
- CounterSet.cs
- RegularExpressionValidator.cs
- BitmapMetadataEnumerator.cs
- StateManager.cs
- WindowProviderWrapper.cs
- DocumentReferenceCollection.cs
- SqlDataSourceCommandEventArgs.cs
- MemberJoinTreeNode.cs
- XmlIncludeAttribute.cs
- odbcmetadatafactory.cs
- ViewStateModeByIdAttribute.cs
- OracleNumber.cs
- AssemblyCacheEntry.cs
- TableMethodGenerator.cs
- HttpProfileBase.cs
- XMLDiffLoader.cs
- Byte.cs
- WhitespaceRuleLookup.cs
- MarshalByValueComponent.cs
- Propagator.ExtentPlaceholderCreator.cs
- __ConsoleStream.cs
- PropertyGrid.cs
- x509store.cs
- TreeNodeBindingCollection.cs
- ExpressionDumper.cs
- SQLConvert.cs
- CookieHandler.cs
- _ConnectionGroup.cs
- ReferencedCollectionType.cs
- SymLanguageVendor.cs
- TableStyle.cs
- StylusOverProperty.cs
- UserControlParser.cs
- RoleGroup.cs
- UpdateManifestForBrowserApplication.cs
- StringDictionaryWithComparer.cs
- AddingNewEventArgs.cs
- remotingproxy.cs
- InvalidAsynchronousStateException.cs
- PowerStatus.cs
- Int16Storage.cs
- TypedServiceOperationListItem.cs
- PeerSecurityHelpers.cs
- Wildcard.cs
- XmlMapping.cs
- WindowsFont.cs
- SizeChangedInfo.cs
- FlowSwitchLink.cs
- TypeValidationEventArgs.cs
- UTF7Encoding.cs
- ToolBar.cs
- login.cs
- Vars.cs
- XPathParser.cs
- DataGridViewLinkColumn.cs
- RoutedEvent.cs
- WsdlBuildProvider.cs
- LinqDataSourceDisposeEventArgs.cs
- XmlFormatExtensionAttribute.cs
- ActivityXamlServices.cs
- ActivityXamlServices.cs
- KnownTypeAttribute.cs
- ThicknessAnimationBase.cs
- InteropTrackingRecord.cs
- X509Chain.cs
- FtpRequestCacheValidator.cs
- CellIdBoolean.cs
- KeyGesture.cs
- Evidence.cs
- CallSiteOps.cs
- SvcMapFileLoader.cs
- DataColumnSelectionConverter.cs
- AuthStoreRoleProvider.cs
- PackWebRequest.cs
- ListParaClient.cs
- Messages.cs
- SqlMethodAttribute.cs
- ProtectedConfigurationProviderCollection.cs
- XmlWrappingReader.cs
- TextTreeUndo.cs
- SelectionListDesigner.cs
- GPStream.cs