/// <Summary>
/// Determine whether the Network is available
/// </Summary>
/// <Returns> True or false </Returns>
Public Static Bool Querynetworkstatus ()
{
Return Microsoft. Phone. net. networkinformation. networkinterface. getisnetworkavailable (); // Whether the current network is available
}
/// <Summary>
/// Obtain the current network type
/// </Summary>
/// <Returns> </returns>
Public Static Type querynetworktype ()
{
Networkinterfacetype _ currentnetworktype = Microsoft. Phone. net. networkinformation. networkinterface. networkinterfacetype; // Obtain the current network type
Type type;
Switch (_ Currentnetworktype)
{
Case Networkinterfacetype. mobilebroadbandcdma:
// "CDMA network ";
Type = type. CDMA network;
Break ;
Case Networkinterfacetype. mobilebroadbandgsm:
// "Csm network ";
Type = type. CSM network;
Break ;
Case Networkinterfacetype. wireless80211:
// "Wireless network ";
Type = type. Wireless Network;
Break ;
Case Networkinterfacetype. Ethernet:
// "Ethernet network ";
Type = type. Ethernet network;
Break ;
Case Networkinterfacetype. None:
// "Network unavailable ";
Type = type. The network is unavailable;
Break ;
Default :
// "Other networks ";
Type = type. Other networks;
Break ;
}
Return Type;
}
/// <Summary>
/// Network Type
/// </Summary>
Public Enum Type
{
CDMA network,
CSM network,
Wireless Network,
Ethernet network,
Network unavailable,
Other networks,
}
}
}
to determine whether the current mobile phone is connected to the PC through Zune, debug it under the device. The connection type of the current simulator is wireless80211