Gesture Class

Definition

Represents a Gesture as a state-machine of GestureSegments.

public class Gesture : Microsoft.Gestures.GestureSegment, System.Windows.Markup.INameScope
Inheritance
Derived
Implements

Remarks

A Gesture is modeled as a state-machine and implemented as a directed graph whose nodes are represented as instances of GestureSegment and whose edges are represented by a single instance of GestureSegmentConnections. In other words, GestureSegments represent states in the state-machine associated with this Gesture (thus GestureSegment and "state" are used interchangeably) while GestureSegmentConnections represent the possible transitions between the states of this Gesture. GestureSegment object type will usually be either HandPose or HandMotion.

In run-time, the state-machine is initialized to the IdleGestureSegment state. When a descendant GestureSegment of the current GestureSegment is detected, the state-machine will advance its current state to point at the corresponding GestureSegment. In order to trigger a Gesture the user is required to execute a series of HandPoses and HandMotions that correspond to a path in the state machine which starts and ends with an IdleGestureSegment. Such a path is called a "triggering path". When a triggering path is detected, the Triggered event of the Gesture will be raised. The client code can subscribe to the Triggered event and respond to the Gesture detection.

When the user executes a complete gesture successfully, or starts advancing along a triggering path and fails to complete the gesture correctly, the state-machine will reset itself (and start again from IdleGestureSegment). The state-machine reset is marked by raising of the IdleTriggered event.

A Gesture instance is mutable until it is registered with the gestures runtime, at which point it becomes frozen and cannot be modified any longer.

Note that a Gesture is itself a GestureSegment and thus Gesture instances can be nested.

Constructors

Gesture()

Creates a blank Gesture with an empty state-machine. In order to represent a meaningful gesture, a sequence of HandPose and\or HandMotion objects would have to be manually added to the Gesture instance (for example, by using the AddTriggeringPath(GestureSegment[]) method).

Gesture(GestureSegment[])

Creates a new Gesture whose state machine is described by the given triggeringPath.

Gesture(String)

Creates a new Gesture called name.

Gesture(String, GestureSegment[])

Creates a new Gesture called name whose state machine is described by the given triggeringPath

Properties

ContainingGesture (Inherited from GestureSegment)
IdleGestureSegment

IdleGestureSegment is the initial state of the state-machine representation of this Gesture instance. Every path in the state machine that starts and ends with the IdleGestureSegment is called a triggering path and corresponds to a legitimate execution of this Gesture instance.

IsFrozen (Inherited from GesturesFrameworkObject)
Item[GestureSegment]

Returns all the consecutive states (GestureSegments) which gestureSegment is pointing at in the state-machine.

Item[String]

Returns the state (GestureSegment) in the state-machine whose name is gestureSegmentName.

Name (Inherited from GestureSegment)
NestingPath (Inherited from GestureSegment)
NextSegments (Inherited from GestureSegment)
Segments

The list of all the GestureSegments comprising the state-machine representation of this Gesture instance.

SegmentsConnections

Represents all the edges connecting states in the state-machine representation of this Gesture instance.

Methods

AddSubPath(GestureSegment[])

Adds a new path to the state-machine associated with this Gesture. Any edges on this path which previously existed in this Gesture will be ignored. Note that adding a new path to the state-machine graph may induce new triggering paths (a triggering path is a series of HandPoses and HandMotions which the user is required to execute in order to trigger the detection of the Gesture).

AddTriggeringPath(GestureSegment[])

Adds a new triggering path (a triggering path is a series of HandPoses and HandMotions which the user is required to execute in order to trigger the detection of the Gesture), described by segments, to the state-machine associated with this Gesture.

AddTriggeringPath(IEnumerable<GestureSegment>)

Adds a new triggering path (a triggering path is a series of HandPoses and HandMotions which the user is required to execute in order to trigger the detection of a Gesture), described by segments, to the state-machine associated with this Gesture.

CalculateHashCode()
Clone(String)

Returns a deep clone of this Gesture.

DeepFreeze()
Equals(Object) (Inherited from GesturesFrameworkObject)
EqualsInternal(Object) (Inherited from GestureSegment)
Equivalent(Gesture)

Performs a deep comparison with other.

Equivalent(GestureSegment)

Performs a deep comparison with other.

FindName(String)
Freeze() (Inherited from GesturesFrameworkObject)
GetHashCode() (Inherited from GesturesFrameworkObject)
InitializeCore()
RegisterName(String, Object)
ToString() (Inherited from GestureSegment)
ToXaml() (Inherited from Xamlizable)
TriggerEvent() (Inherited from GestureSegment)
TriggerEventAsync(Int32) (Inherited from GestureSegment)
UnregisterName(String)
ValidateCore()
VerifyNotFrozen(String) (Inherited from GesturesFrameworkObject)

Events

IdleTriggered

Raised whenever the state-machine of this Gesture is reset (i.e., its state reaches the IdleGestureSegment). This happens either when the Gesture is successfully triggered or when the state-machine starts advancing along a triggering path but the Gesture is not executed to completion and the path is abandoned (a triggering path is a series of HandPoses and HandMotions which the user is required to execute in order to trigger the detection of a Gesture).

Triggered (Inherited from GestureSegment)

Explicit Interface Implementations

INameScope.FindName(String)
INameScope.RegisterName(String, Object)
INameScope.UnregisterName(String)
ISupportInitialize.BeginInit() (Inherited from Xamlizable)
ISupportInitialize.EndInit() (Inherited from Xamlizable)
IUriContext.BaseUri (Inherited from Xamlizable)
IValidatable.Validate() (Inherited from GesturesFrameworkObject)

Applies to