//Initialise class and base public Touch(int pTapTimeout = 500, double pThreshold = 4) : base("rMultiplatform.Touch") { GestureThreshold = pThreshold; TapTimeout = pTapTimeout; Mode = TouchMode.Normal; TapTimer = new CancellableTimer(TimeSpan.FromMilliseconds(TapTimeout), TapTimer_Expired); PreviousType = TouchPoint.eTouchType.eReleased; Cursors = new Dictionary <uint, TouchCursor>(); }
public void OnTouchAction(Element e, TouchActionEventArgs a) { var type = a.Location.TouchType; var change = type != PreviousType; switch (type) { case TouchPoint.eTouchType.eMoved: switch (PreviousType) { case TouchPoint.eTouchType.eReleased: SafeHover(e, a); break; case TouchPoint.eTouchType.ePressed: SafePressedMove(e, a); break; default: throw (new Exception("Cannot determine previous state. It must be pressed or released")); } break; case TouchPoint.eTouchType.ePressed: if (change) { SafePressed(e, a); } break; case TouchPoint.eTouchType.eReleased: SafeReleased(e, a); break; default: throw (new Exception("Do not issue commands other than pressed, released and move from a device.")); } //Moved is not a state change if (type != TouchPoint.eTouchType.eMoved) { PreviousType = type; } }