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
- ScriptingProfileServiceSection.cs
- _LazyAsyncResult.cs
- QueryCacheManager.cs
- WindowsProgressbar.cs
- CredentialCache.cs
- TextDecoration.cs
- RawTextInputReport.cs
- ObjectStateEntryDbDataRecord.cs
- SecurityTokenAuthenticator.cs
- TypeReference.cs
- ImmutablePropertyDescriptorGridEntry.cs
- ContainerAction.cs
- IncrementalHitTester.cs
- ApplicationServiceManager.cs
- MouseActionValueSerializer.cs
- XmlWhitespace.cs
- EnumCodeDomSerializer.cs
- EntitySqlQueryState.cs
- ReferenceConverter.cs
- SafeFileMappingHandle.cs
- DataGridViewAdvancedBorderStyle.cs
- PeerPresenceInfo.cs
- WebPartMenuStyle.cs
- ObjectContext.cs
- SortDescription.cs
- LineBreakRecord.cs
- DetailsViewRow.cs
- SignedPkcs7.cs
- RelationshipWrapper.cs
- WebServiceData.cs
- PolygonHotSpot.cs
- ActiveXHelper.cs
- FactoryId.cs
- ToolStripRenderEventArgs.cs
- MenuItemBinding.cs
- PermissionAttributes.cs
- ProxyElement.cs
- ControlsConfig.cs
- DiscoveryViaBehavior.cs
- SmiConnection.cs
- Visual3D.cs
- PageParser.cs
- DataGridItem.cs
- Assert.cs
- KoreanCalendar.cs
- Accessible.cs
- ProcessStartInfo.cs
- NativeWindow.cs
- RepeaterItemCollection.cs
- BindValidationContext.cs
- PropertyInformation.cs
- InvokeHandlers.cs
- StructuralType.cs
- CommandEventArgs.cs
- TwoPhaseCommit.cs
- ExecutionContext.cs
- PrintController.cs
- StyleCollection.cs
- ValidationResult.cs
- DataGridViewCellCollection.cs
- MenuItemCollectionEditor.cs
- SessionStateUtil.cs
- WebPageTraceListener.cs
- UIElementParaClient.cs
- TypeSemantics.cs
- HttpListener.cs
- Line.cs
- OperandQuery.cs
- EventPropertyMap.cs
- XmlToDatasetMap.cs
- MinimizableAttributeTypeConverter.cs
- DataGridViewAutoSizeModeEventArgs.cs
- AutoResetEvent.cs
- SortedList.cs
- ScriptResourceHandler.cs
- ToolStripDropDownItemDesigner.cs
- MessageBox.cs
- RowBinding.cs
- TextSelectionHighlightLayer.cs
- FixUp.cs
- TraceSource.cs
- RegionIterator.cs
- DbQueryCommandTree.cs
- ResourceManagerWrapper.cs
- FunctionQuery.cs
- InheritanceContextHelper.cs
- BitmapEffectOutputConnector.cs
- SchemaCompiler.cs
- StoreItemCollection.Loader.cs
- JsonEncodingStreamWrapper.cs
- DecimalConstantAttribute.cs
- MenuScrollingVisibilityConverter.cs
- DataGridViewRowHeaderCell.cs
- HtmlInputHidden.cs
- QuaternionRotation3D.cs
- CompositeFontFamily.cs
- PartialCachingControl.cs
- MetadataException.cs
- GeneralTransform3DGroup.cs
- SiteOfOriginContainer.cs