Windows phone 7 如何检测接触点的数量已变为0?
我使用以下代码来检测触点。然而,当用户的手指完全离开屏幕时,我的处理程序永远不会被调用 问题-我如何检测到接触点的数量已变为0Windows phone 7 如何检测接触点的数量已变为0?,windows-phone-7,windows-phone-7.1,windows-phone,Windows Phone 7,Windows Phone 7.1,Windows Phone,我使用以下代码来检测触点。然而,当用户的手指完全离开屏幕时,我的处理程序永远不会被调用 问题-我如何检测到接触点的数量已变为0 public MainPage() { InitializeComponent(); Touch.FrameReported += new TouchFrameEventHandler(OnFrameReported); } private void OnFrameReported(object sen
public MainPage()
{
InitializeComponent();
Touch.FrameReported += new TouchFrameEventHandler(OnFrameReported);
}
private void OnFrameReported(object sender, TouchFrameEventArgs e)
{
var args = e.GetTouchPoints(null);
我找到的最好的答案是听manufactioncomplete,得到用户正在举起最后一根手指的通知。但是,在那之后,您仍然会得到一些后续的触摸帧。所以我们需要忽略它们。。。我只是忽略了下一秒的内容,但这可能太过分了
public MainPage()
{
...
ManipulationCompleted += OnManipulationCompleted;
...
}
private void OnManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
{
OnFrameReported(this, null);
m_whenStopIgnoringTouchEvents = Environment.TickCount + 1000;
}
private void OnFrameReported(object sender, TouchFrameEventArgs e)
{
if (e != null)
{
if(Environment.TickCount > m_whenStopIgnoringTouchEvents)
{
// null indicates the touch point information is relative to the
// top left corner
var args = e.GetTouchPoints(null);
...
}
}
}
private int m_whenStopIgnoringTouchEvents = 0;