GestureService per WP7

El Windows Phone Toolkit porta una característica molt interessant per treballar amb els gestos sobre Windows Phone. Estic parlant del GestureService que permet poder interpretar els següents gestos (almenys amb la versió  September 2012) :

Single-touch

Tap

Tap

Touch and Hold

Touch and Hold

Double Tap

Double Tap

Pan

Pan

Flick

Flick

Multi-touch

Pinch and Stretch

Pinch and Stretch

Cada un d’aquests gestos son interpretats per el servei i s’ens comunica per events:

Key event

  1. GestureBegin
    1. The GestureBegin event.
  2. GestureCompleted
    1. The GestureCompleted event.
  3. Tap
    1. The Tap event (touch, release, no movement).
  4. DoubleTap
    1. The DoubleTap event is raised instead of Tap if the time between two taps is short enough.
  5. Hold
    1. The Hold event (touch and hold for one second)
  6. DragStarted
    1. The DragStarted event.
  7. DragDelta
    1. The DragDelta event.
  8. DragCompleted
    1. The DragCompleted event. Will be raised on touch release after a drag, or when a second touch point is added.
  9. Flick
    1. The Flick event. Raised when a drag that was fast enough ends with a release.
  10. PinchStarted
    1. The PinchStarted event.
  11. PinchDelta
    1. Any two-touch point (two finger) operation.
  12. PinchCompleted
    1. The end of a pinch operation.

Sense aquest servei Windows Phone SDK porta per cada un dels controls la gestió dels gestos per tres events:

  1. ManipulationStarted
    1. Occurs when an input device begins a manipulation on the UIElement
  2. ManipulationDelta
    1. Occurs when the input device changes position during a manipulation.
  3. ManipulationCompleted
    1. Occurs when a manipulation and inertia on the UIElement is complete.A myriad of other events when it’s moved, sized, etc.

El problema d’aquests events és que la interpretació del moviment l’ha de fer el programador.

Per tant, molt bé per el toolkit, ens fa molta feina.

Més informació:

WP7 GestureService in depth | key concepts and API

Anuncis