现在的位置: 首页 > 综合 > 正文

『参考』使用.net CF自带库判断设备的连接状态

2011年10月11日 ⁄ 综合 ⁄ 共 2444字 ⁄ 字号 评论关闭

问题来自 MSDN Forums : ActiveSync 连线状态

简述如下

如何抓出目前是否与 ActiveSync 连线状态,比如有连线就等于 True,没连线就等于 False

我试过 ActiveSyncStatus.Synchronizing 以及 SystemState.ActiveSyncStatus

似乎都不是可以判断 PDA 是否有与 ActiveSync 连线

解决办法:

使用 SystemState.CradlePresent 属性: Gets a value indicating whether the device is connected to a cradle.

使用时需将 Microsoft.WindowsMobile、Microsoft.WindowsMobile.Status 加入引用 

代码

以下代码是当 Button Click 时,取得并显示 SystemState.CradlePresent 属性 的状态

 

button1_Click

 

以下代码是当 System Status 改变时,取得并显示 SystemState.CradlePresent 属性 的状态

 

mSystemState_Changed

 

文章引用:

SystemState.CradlePresent 屬性

How to Get Activesync Status in Smart Device

抱歉!评论已关闭.