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; } } } }
查看全文
相关阅读:
LeetCode--Divide Two Integers
mysql多实例安装与ssl认证
ajax请求
mysql5.6升级及mysql无密码登录
mysql5.7密码设置
BusyBox 添加 自定义命令小程序 (applet)
分享9个常用的国外英文论文文献数据库
arm linux 移植 gdb/gdbserver
使用 mtd-utils 烧写Arm Linux 系统各个部分
YUV图解 (YUV444, YUV422, YUV420, YV12, NV12, NV21)
原文地址:https://www.cnblogs.com/javawebsoa/p/2458110.html
最新文章
SpringMVC拦截器配置
从printXX看tty设备(4)伪终端
从printXX看tty设备(2)VGA显示模拟
从printXX看tty设备(1)tty基础
PowerPC下连接器--relax选项实现
信号间优先级及线程优先级对信号的影响
Linux下符号版本原理及实现
从pthread_self看GNU ld链接器
从根文件系统制作看loop设备
i386 relocatable内核实现
热门文章
Linux中多CPU的runqueue及抢占
逆序对算法(reverse pair)
二分查找算法
LeetCode--Maximum Subarray
Merge-Sort(归并排序)
插入排序
2-Color Dutch National Flag Problem
LeetCode Weekly Contest 23
Moore majority vote algorithm(摩尔投票算法)
LeetCode--Pow(x, n)
Copyright © 2011-2022 走看看