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; } } } }
查看全文
相关阅读:
时间戳与时间之间的相互转化
源代码管理之Git命令的使用
ios最新设置状态栏字体颜色总结
iOS 代码方式设置按钮标题、图片的偏移
runloop简单介绍
iOS中的多线程NSThread/GCD/NSOperation & NSOperationQueue
AFNetworking的详细解析
MATLAB相关快捷键以及常用函数
CentOS 5.8下快速搭建FTP服务器
php获取跳转后的真实链接
原文地址:https://www.cnblogs.com/javawebsoa/p/2458110.html
最新文章
根据Edittext搜索,listview动态显示
分组的listview——ExpandableListView
不要放弃使用border-box
Vuex的一个易错点
Vue中this的绑定
关于生命周期里执行setState
padding百分百值是相对谁的百分比
使用关联对象(AssociatedObject)为UIButton添加Block响应
ReactiveCocoa学习
仿微信表情输入
热门文章
自定义UICollectionViewLayout 实现瀑布流
OC 实现多选参数
iOS 自定义button
iOS 混合网页开发 问题
iOS进阶:Objective-C runtime(一)
iOS 使用UILocalizedIndexedCollation实现区域索引标题(Section Indexed Title)即拼音排序
iOS iOS9下修改回HTTP模式进行网络请求
iOS常用的宏定义总结
iOS中的成员变量,实例变量,属性变量
iOS常用的正则表达式总结
Copyright © 2011-2022 走看看