【Windows mobile 转WP7 学习笔记】 我们还需要cmnet,cmwap么?
【以下都是自己学习中发现的一些问题,如有任何问题请指正】
我相信做过windows mobile开发的都知道,自己的程序都要去建立连接的,尤其是在一些要使用wap
网关的时候,我们都要在程序中建立连接。那么WP7是否还需要了?
答案当然是不需要了。
When Windows Phone starts, it can take up to 20 seconds for the first call to the M:System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable to return. This is because Windows Phone initially enumerates all the available network connections.
以上见Windows Phone 7最新离线文档。
那么我们网络不可用怎么办了?
我们可以使用如下方式判断。
using System.Net.NetworkInformation;
bool bNetOK = NetworkInterface.GetIsNetworkAvailable();
网络不可用时提示用户即可。
PS:这是第一次发大家见谅。