如何检测电话(WP7)已停止晃动 [英] How to detect that the phone (WP7) has stopped shaking
本文介绍了如何检测电话(WP7)已停止晃动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以让手机对震动做出反应,但是最好的方式来表明它已经停止震动了?
I can get the phone to react to a shake, but what is the best way to tell that it has stopped shaking?
推荐答案
此示例为我工作。
在页面的最底部,您将看到:
At the very bottom of the page you'll see:
if (!_shaking && CheckForShake(_lastReading, reading, ShakeThreshold) && _shakeCount >= 1)
{
//We are shaking
_shaking = true;
_shakeCount = 0;
OnShakeDetected();
}
else if (CheckForShake(_lastReading, reading, ShakeThreshold))
{
_shakeCount++;
}
else if (!CheckForShake(_lastReading, reading, 0.2))
{
_shakeCount = 0;
_shaking = false;
}
这篇关于如何检测电话(WP7)已停止晃动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文