InertiaProcessor2D.Complete(Int64) 方法

定义

通过使用指定时间戳完成最终外推并引发 Completed 事件。

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

参数

timestamp
Int64

用于完成外推的时间戳(以 100 纳秒为单位的时钟周期)。

例外

时间戳参数小于初始或上一个时间戳。

示例

在以下示例中,事件的事件处理程序 ManipulationProcessor2D.Started 检查惯性处理是否正在运行,如果是,则通过调用 Complete 方法停止它。

#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

注解

时间戳以 100 纳秒为单位。

适用于