您的位置:首页 > 其它

Windows Phone Dev Notes-关于WP7 OS 7.0和7.1的加速度传感器数据获取方法差异

2012-05-25 08:50 309 查看
问题描述

对于加速度传感器,数据获取是一个最基本的事件。但是OS 7.0和OS7.1版本有所差异。这个问题源于中文技术论坛上的一个帖子:关于Accelerometer中CurrentValueChanged事件兼容性问题

分析

从《MSDN:Accelerometer Class》网页上来看,在目前的WP 7.5 OS中,ReadingChanged已经弃用,请改用CurrentValueChanged。

对于ReadingChanged,是这么解释的:Obsolete.Occurs when new data arrives from the accelerometer. This method is deprecated in the current release. Applications should use theCurrentValueChanged event of theSensorBase<TSensorReading> class instead.

结论

WP SDK 7.1新建项目时,可以选择目标是OS 7.0 或者是 OS 7.1的。如果要为mango以前的系统写app进行调试,应该选择OS 7.1,对应于CurrentValueChanged事件,而OS 7.0,还是使用

ReadingChanged事件。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐