ConnectionProfile Class

表示网络连接,包括当前或之前的网络连接。 提供有关连接状态和连接性统计数据的信息。

语法


var connectionProfile = getInternetConnectionProfile();

特性

[DualApiPartition()]
[MarshalingBehavior(Agile)]
[Version(0x06020000)]

成员

ConnectionProfile类 具有这些类型的成员:

方法

The ConnectionProfile 类 具有这些方法。 对于 C#、Visual Basic 和 C++,它还继承方法于Object 类.

方法说明
GetConnectionCost Gets the cost information for the connection.
GetConnectivityIntervalsAsync Gets a list of ConnectivityInterval objects, which indicate the timestamp for when the network connection began, and a time-span for the duration of that connection.
GetDataPlanStatus Gets the current status of the data plan associated with the connection.
GetDomainConnectivityLevel Gets the current domain authentication status for a network connection. Possible values are defined by DomainConnectivityLevel.
GetLocalUsage(DateTime, DateTime) Gets the estimated data usage for a connection during over a specific period of time.
GetLocalUsage(DateTime, DateTime, RoamingStates) Gets the estimated data usage for a connection over a specific period of time and roaming state.
GetNetworkConnectivityLevel Gets the network connectivity level for this connection. This value indicates what network resources, if any, are currently available.
GetNetworkNames Retrieves names associated with the network with which the connection is currently established.
GetNetworkUsageAsync Gets a list of the estimated data traffic and connection duration over a specified period of time, for a specific network usage state.
GetSignalBars Gets a value that indicates the current number of signal bars displayed by the Windows UI for the connection.

 

属性

ConnectionProfile类 具有这些属性。

属性访问类型说明

IsWlanConnectionProfile

只读Gets a value that indicates if connection profile is a WLAN (WiFi) connection. This determines whether or not WlanConnectionProfileDetails is null.

IsWwanConnectionProfile

只读Gets a value that indicates if connection profile is a WWAN (mobile) connection. This determines whether or not WwanConnectionProfileDetails is null.

NetworkAdapter

只读Gets the object representing the network adapter providing connectivity for the connection.

NetworkSecuritySettings

只读Retrieves the security settings for the network.

ProfileName

只读Gets the name of the connection profile.

ServiceProviderGuid

只读Gets the ID of the network operator who provisioned the connection profile.

WlanConnectionProfileDetails

只读Contains properties and methods defined by WlanConnectionProfile that are specific to WLAN (WiFi) connections.

WwanConnectionProfileDetails

只读Contains the properties and methods defined by WwanConnectionProfile that are specific to mobile broadband connections.

 

备注

下面的示例函数演示如何检索 ConnectionProfile 中的数据。


function getConnectionProfileInfo(connectionProfile) {
			  
     returnString += "Connection Cost Information:\n\r";
     returnString += "===============\n\r";
     var connectionCost = connectionProfile.getConnectionCost();
     returnString += "Cost Type: " + getCostType(connectionCost.networkCostType) + "\n\r";
     returnString += "Roaming: " + connectionCost.roaming + "\n\r";
     returnString += "Over Datalimit: " + connectionCost.overDataLimit + "\n\r";
     returnString += "Approaching Datalimit: " + connectionCost.approachingDataLimit + "\n\r";
}


有关如何实现这些类方法以访问连接信息的更多示例,请参见快速入门:检索网络连接信息

要求

最低支持客户端

Windows 8 [Windows 应用商店应用程序, 桌面应用程序]

最低支持服务器

不支持“无” [Windows 应用商店应用程序, 桌面应用程序]

最低支持电话

Windows Phone 8

命名空间

Windows.Networking.Connectivity
Windows::Networking::Connectivity [C++]

元数据

Windows.winmd

 

 

显示:
© 2014 Microsoft