Redigera

Dela via


InertiaProcessor2D.Complete(Int64) Method

Definition

Completes final extrapolation by using the specified timestamp and raises the Completed event.

public:
 void Complete(long timestamp);
public void Complete (long timestamp);
member this.Complete : int64 -> unit
Public Sub Complete (timestamp As Long)

Parameters

timestamp
Int64

The timestamp to complete extrapolation, in 100-nanosecond ticks.

Exceptions

The timestamp parameter is less than the initial or previous timestamp.

Examples

In the following example, an event handler for the ManipulationProcessor2D.Started event checks to see if inertia processing is running and if so, stops it by calling the Complete method.

#region OnManipulationStarted
private void OnManipulationStarted(object sender, Manipulation2DStartedEventArgs e)
{
    if (inertiaProcessor.IsRunning)
    {
        inertiaProcessor.Complete(Timestamp);
    }
}
#endregion
#region Timestamp
private long Timestamp
{
    get
    {
        // Get timestamp in 100-nanosecond units.
        double nanosecondsPerTick = 1000000000.0 / System.Diagnostics.Stopwatch.Frequency;
        return (long)(System.Diagnostics.Stopwatch.GetTimestamp() / nanosecondsPerTick / 100.0);
    }
}
#endregion

Remarks

Timestamps are in 100-nanosecond units.

Applies to