protected override void UseGesture(GestureNotification gesture, bool isFilterMatch, int index) { if (isFilterMatch) { double distance = (double)(gesture.Arguments & Const.ULL_ARGUMENTS_BIT_MASK); if (index < 0) { DistanceOut.Add(distance / (double)gesture.ClientArea.Height * 2); } else { DistanceOut[index] = distance / (double)gesture.ClientArea.Height * 2; } } else if (index >= 0) { DistanceOut.RemoveAt(index); } }
protected override void UseGesture(GestureNotification gesture, bool isFilterMatch, int index) { if (isFilterMatch) { double rotate = (double)(gesture.Arguments & Const.ULL_ARGUMENTS_BIT_MASK); rotate = rotate / 65535.0 * 2 - 1; if (index < 0) { RotateOut.Add(rotate); } else { RotateOut[index] = rotate; } } else if (index >= 0) { RotateOut.RemoveAt(index); } }
public static TResult GestureNotificationSwitch <TResult>(GestureNotification notification, TResult defaultResult, Func <GestureBeginNotification, TResult> onBegin, Func <GestureEndNotification, TResult> onEnd, Func <GestureZoomNotification, TResult> onZoom, Func <GesturePanNotification, TResult> onPan, Func <GestureRotateNotification, TResult> onRotate, Func <GestureTwoFingerTapNotification, TResult> onTwoFingerTap, Func <GesturePressAndTapNotification, TResult> onPressAndTap) where TResult : class { switch (notification.Kind) { case GestureNotificationKind.GestureBegin: return(onBegin?.Invoke((GestureBeginNotification)notification) ?? defaultResult); case GestureNotificationKind.GestureEnd: return(onEnd?.Invoke((GestureEndNotification)notification) ?? defaultResult); case GestureNotificationKind.GestureZoom: return(onZoom?.Invoke((GestureZoomNotification)notification) ?? defaultResult); case GestureNotificationKind.GesturePan: return(onPan?.Invoke((GesturePanNotification)notification) ?? defaultResult); case GestureNotificationKind.GestureRotate: return(onRotate?.Invoke((GestureRotateNotification)notification) ?? defaultResult); case GestureNotificationKind.GestureTwoFingerTap: return(onTwoFingerTap?.Invoke((GestureTwoFingerTapNotification)notification) ?? defaultResult); case GestureNotificationKind.GesturePressAndTap: return(onPressAndTap?.Invoke((GesturePressAndTapNotification)notification) ?? defaultResult); default: return(defaultResult); } }
protected virtual void UseGesture(GestureNotification gesture, bool isFilterMatch, int index) { }