如何在 wp7 中检查 InternetConnection? [英] how to check InternetConnection in wp7?

查看:30
本文介绍了如何在 wp7 中检查 InternetConnection?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的应用程序中检查互联网连接.但是,它显示不正确.

i want to check internet connection in my application.but, its not displaying properly.

我正在使用此代码进行互联网连接:

i am using this code for internet connection:

 NetworkInterface.GetIsNetworkAvailable();

在这段代码中总是返回真值.如果网络可用或不可用只返回真值.

in this code always return true value.if net available or not available return true only.

如果有人知道请告诉我这样做的想法.

if anyone know tell me idea to do this.

谢谢.

推荐答案

检查 NetworkInterfaceType.如果互联网可用,那么它应该不是

Check NetworkInterfaceType. If Internet is available then It should be other than None

 return (Microsoft.Phone.Net.NetworkInformation.NetworkInterface.NetworkInterfaceType != 
 Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType.None);

这篇关于如何在 wp7 中检查 InternetConnection?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆