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; } } } }
查看全文
相关阅读:
Xcode9新特性介绍-中文篇
基于Mac制作iPhone铃声教程,iTunes定制铃声
浅谈Swift和OC的区别
Your password has expired. To log in you must change it using a client that supports expired passwords.
浅谈测试驱动开发(TDD)
ClientAbortException: java.net.SocketException: 断开的管道
nohup top & 问题: top: failed tty get
rsync 学习
myeclipse项目 不能打开
ChannelSftp 远程下载目录
原文地址:https://www.cnblogs.com/javawebsoa/p/2458110.html
最新文章
linux 安装配置Jenkins
Java内存的 静态方法和实例方法的区别及使用场景
StringUtils.isEmpty StringUtils.isBlank
Apache Jakarta Commons 工具集简介
spring @CrossOrigin解决跨域问题
gradle用户目录本地库移动设置
spring @Autowired与@Resource的区别
Centos7.3安装和配置Mysql5.7
LinkedHashMap 根据PUT顺序排序Map
springboot整合shiro应用
热门文章
springBoot 全局异常方式处理自定义异常 @RestControllerAdvice + @ExceptionHandler
API权限设计总结
MySQL查看SQL语句执行效率
iOS UILabel设置行间距和字间距
Swift3 GCD队列优先级说明
iOS获取ipa素材、提取ipa资源图片文件
Swift打印Debug日志,实现Release下不打印
Safari导入书签
Swift实现JSON转Model
iOS开发Safari调试WebView页面
Copyright © 2011-2022 走看看