Windows Store App, Shaken

        Accelerometer _accelerometer;
int _shakeCount = ;
public MainPage()
{
this.InitializeComponent();
_accelerometer=Accelerometer.GetDefault();
if (_accelerometer != null)
_accelerometer.Shaken += new TypedEventHandler<Accelerometer, AccelerometerShakenEventArgs>(Shaken);
} async private void Shaken(object sender, AccelerometerShakenEventArgs e)
{
await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
_shakeCount++;
}); if (_shakeCount >= )
{
//method call
_shakeCount = ;
}
}

Don't know if it works?

上一篇:JSON介绍与JavaScript解析


下一篇:NHibernate之映射文件配置说明