2
我正在开发云备份软件。该应用程序是使用C#开发的桌面应用程序。在桌面应用程序中检测Windows 7和8中的3G连接
如果计算机连接到3G网络以节省用户成本,我需要添加一个选项以停止/暂停备份。
我似乎无法找到任何有关如何实现此功能的示例,但有一些Windows Phone和Windows应用商店应用示例,但找不到任何可以检查连接类型是WiFi/Ethernet还是3G后者是我最关心的问题。
我尝试了测试应用程序来枚举网络:
Console.WriteLine("checking network interfaces\n");
NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces();
foreach (var networkInterface in interfaces)
{
Console.WriteLine("Interface Detected");
Console.WriteLine("Description: "+networkInterface.Description);
Console.WriteLine("ID: " + networkInterface.Id);
Console.WriteLine("Name: " + networkInterface.Name);
Console.WriteLine("Interface Type: " + networkInterface.NetworkInterfaceType);
Console.WriteLine("Operational Status: " + networkInterface.OperationalStatus.ToString());
Console.WriteLine("Speed: " + networkInterface.Speed.ToString());
Console.WriteLine("Supports Multicast: " + networkInterface.SupportsMulticast.ToString());
Console.WriteLine("#########################################################\n");
}
上面的代码列表我的3G连接为PPP其可以是ADSL或3G。我不确定是否可以使用其他选项或API进行区分
我需要明确的方式来区分这些网络,到目前为止我找不到这样做的方法。
有人可以帮忙吗?
Thnaks,我想我可以用这些接口工作 –