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; } } } }
查看全文
相关阅读:
Web版RSS阅读器(五)——初步完成阅读功能
袁氏-人物-袁赋城:百科
汉语-词语-慧根:百科
汉语-词语-善根:百科
汉语-词语-阴德:百科
汉语-词语-福报:百科
汉语-词语-回响:百科
汉语-词语-领悟:百科
汉语-词语-开悟:百科
汉语-词语-业障:百科
原文地址:https://www.cnblogs.com/javawebsoa/p/2458110.html
最新文章
从码农到农民的芋头哥:3个月卖出20万斤(转)
Linux Bash 脚本:自己定义延迟代码块(裸数据保存方案)
[SQL]查询某一个字段在某一段时期数据库中使用到的记录
怎样搭建轻量级架构-敏捷开发普及篇
AFN同步异步请求
初识node.js
HDUOj Ignatius and the Princess III 题目1002
VIM经常使用操作
链串的基本运算
Throwing cards away I uva1594
热门文章
Android面向HTTP协议发送post请求
Project Euler 001-006 解法总结
Citrix服务器虚拟化之二十九 XenApp 6.5发布服务器上的应用程序
外媒关注:中国版Twitter新浪微博推出微米对抗微信
Hadoop HelloWord Examples -对Hadoop FileSystem进行操作
OpenMeetings(4)----新用户注册
Asp.net视图状态的作用
[置顶] 深入浅出Spring(四) Spring实例分析
在github Pages上部署octopress搭建个人博客系统
Linux环境下c语言静态链接库和动态链接库创建和使用
Copyright © 2011-2022 走看看