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
- SafeLibraryHandle.cs
- WebPartTransformerAttribute.cs
- SplitterPanelDesigner.cs
- ParserExtension.cs
- UnknownBitmapDecoder.cs
- DetailsViewDeleteEventArgs.cs
- ListControlActionList.cs
- XamlPathDataSerializer.cs
- DataColumnCollection.cs
- ArglessEventHandlerProxy.cs
- TrustSection.cs
- HtmlTernaryTree.cs
- DataControlFieldCell.cs
- XmlNotation.cs
- HashAlgorithm.cs
- HttpCapabilitiesEvaluator.cs
- SamlDelegatingWriter.cs
- DeflateStreamAsyncResult.cs
- DSASignatureFormatter.cs
- DeclarativeCatalogPart.cs
- ButtonChrome.cs
- Marshal.cs
- FormsIdentity.cs
- ReadWriteObjectLock.cs
- EdmToObjectNamespaceMap.cs
- DispatcherHooks.cs
- ZipFileInfo.cs
- PathFigure.cs
- TrackingQuery.cs
- ContractAdapter.cs
- MediaContextNotificationWindow.cs
- LabelExpression.cs
- ListSourceHelper.cs
- BuilderInfo.cs
- ActivityBindForm.cs
- TrustExchangeException.cs
- DbProviderManifest.cs
- HwndSubclass.cs
- EntityCommand.cs
- TransformerInfoCollection.cs
- GACMembershipCondition.cs
- XmlSchemaAppInfo.cs
- MergablePropertyAttribute.cs
- ParseHttpDate.cs
- HttpModule.cs
- Label.cs
- WeakHashtable.cs
- DbProviderServices.cs
- FontFamily.cs
- RtfFormatStack.cs
- TTSEngineTypes.cs
- SemanticValue.cs
- TimeoutConverter.cs
- CustomWebEventKey.cs
- CorePropertiesFilter.cs
- CompiledQuery.cs
- GlobalAllocSafeHandle.cs
- SystemIcmpV6Statistics.cs
- Context.cs
- OracleBinary.cs
- GeneralTransform2DTo3DTo2D.cs
- HostSecurityManager.cs
- StorageRoot.cs
- TriggerCollection.cs
- DependentList.cs
- StylusCaptureWithinProperty.cs
- AssemblyHash.cs
- EventLogPermissionAttribute.cs
- CornerRadiusConverter.cs
- RegistryKey.cs
- MobileListItemCollection.cs
- ReadOnlyHierarchicalDataSource.cs
- SettingsPropertyValueCollection.cs
- AsyncOperation.cs
- FilteredReadOnlyMetadataCollection.cs
- glyphs.cs
- AsyncDataRequest.cs
- BooleanToVisibilityConverter.cs
- httpserverutility.cs
- EventLogPermission.cs
- WebPartAuthorizationEventArgs.cs
- AsyncOperationManager.cs
- ConfigXmlText.cs
- RegexWriter.cs
- ConfigurationStrings.cs
- Completion.cs
- SubstitutionResponseElement.cs
- DeviceContext2.cs
- MultilineStringConverter.cs
- PresentationTraceSources.cs
- FileVersionInfo.cs
- DataIdProcessor.cs
- Ref.cs
- SmtpCommands.cs
- XhtmlBasicLinkAdapter.cs
- COM2ColorConverter.cs
- ParentControlDesigner.cs
- TemplateContentLoader.cs
- Table.cs
- TextServicesContext.cs