public bool Transfer(INativeMotionTarget target, object context) { if (target == null) { throw new ArgumentNullException("target"); } RaiseEvent(new NativeMotionTransferEventArgs(_info, _nativeSourceDelta) { RoutedEvent = TransferingEvent }); if (Math.Sign(_nativeSourceDelta) == _info.NativeDirection) { var converter = _info.Source as INativeMotionConverter; int nativeTargetDelta = target.Coerce(_info, context, _nativeSourceDelta); if (!DoubleEx.IsZero(nativeTargetDelta)) { target.Move(_info, context, nativeTargetDelta); EndTransfer(nativeTargetDelta, converter.NativeResolutionFrequency); } } return(target.CanMove(_info, context)); }
public bool Transfer(INativeMotionTarget target, object context) { if (target == null) { throw new ArgumentNullException(nameof(target)); } RaiseEvent(new NativeMotionTransferEventArgs(MotionInfo, NativeRemainder) { RoutedEvent = TransferingEvent }); if (Math.Sign(NativeRemainder) == MotionInfo.NativeDirection) { var converter = (INativeMotionConverter)MotionInfo.Source; var nativeTargetDelta = target.Coerce(MotionInfo, context, NativeRemainder); if (!DoubleEx.IsZero(nativeTargetDelta)) { target.Move(MotionInfo, context, nativeTargetDelta); EndTransfer(nativeTargetDelta, converter.NativeResolutionFrequency); } } return(target.CanMove(MotionInfo, context)); }