zoukankan
html css js c++ java
Windows Phone 7 开发之检查手机网络
using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; using Microsoft.Phone.Controls; using System.Net.NetworkInformation; using Microsoft.Phone.Net.NetworkInformation; namespace checknet { public partial class MainPage : PhoneApplicationPage { private bool networkIsAvailable; private NetworkInterfaceType _currentNetworkType; //网络连接的类型 public MainPage() { InitializeComponent(); } private void button1_Click(object sender, RoutedEventArgs e) { networkIsAvailable = Microsoft.Phone.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable();//当前网络是否可用 _currentNetworkType = Microsoft.Phone.Net.NetworkInformation.NetworkInterface.NetworkInterfaceType;//获取当前网络的类型 if (networkIsAvailable) { Message.Text = "联网状态"; Message.Background = new SolidColorBrush(Colors.Green); } else { Message.Text = "断网状态"; Message.Background = new SolidColorBrush(Colors.Red); } switch (_currentNetworkType) { case NetworkInterfaceType.MobileBroadbandCdma: netname.Text = "Cdma网络"; break; case NetworkInterfaceType.MobileBroadbandGsm: netname.Text = "Csm网络"; break; case NetworkInterfaceType.Wireless80211: netname.Text = "Wireless网络"; break; case NetworkInterfaceType.Ethernet: netname.Text = "Ethernet网络"; break; case NetworkInterfaceType.None: netname.Text = "网络不可用"; break; default: netname.Text = "其他的网络"; break; } } } }
查看全文
相关阅读:
MySQL批量删除指定前缀表
jquery--checkbox全选/全不选
jquery--监听checkbox多选框是否选中,展示输入框
shell--脚本之间传值,模仿jenkins内置变量的功能
python--os模块递归本地目录
python--脚本添加定时任务
paramiko--密钥连接远端服务器并递归目录
django--完成客户端下载文件的三种方式
python--如何给dict字典类型排序
python--时间相差8小时问题
原文地址:https://www.cnblogs.com/javawebsoa/p/2458110.html
最新文章
(转载--实测有效)ubuntu( mint )下 vi输入方向键会变成ABCD的解决方法
用$("...").attr("checked", true)设置勾选无效的原因
php curl模块开启失败解决参考
Yii2.0 使用createcommand从数据库查询出来的int类型变成了string型
yii2.0查询慢的原因
中英文混截,一个中文相当于n个英文
mysql的乐观锁和悲观锁
sql优化 in 和 not in 语句
使用redis实现简单的锁机制
php中json_encode和json_decode的用法
热门文章
url为什么要编码及php中的中文字符urlencode基本原理
Could not load file or assembly 'System.ServiceModel.DomainServices.Hosting'.系统找不到指定文件
input file控件限制上传文件类型
Windows 8.1安装 Vmware10
织梦后台登陆验证码不能正常显示
没有为扩展名“.html”注册的生成提供程序
使用ajax.dll时js脚本错误-XXX未定义
设置网页图片热点链接以及坐标值
HTTP错误500.19-定义了重复的节点
[CSS]Input标签与图片按钮对齐
Copyright © 2011-2022 走看看