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

题描述

    对于加速度传感器,数据获取是一个最基本的事件。但是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事件。
posted on 2012-05-25 08:50  施炯  阅读(565)  评论(0编辑  收藏  举报