NetworkInformation.NetworkStatusChanged 事件
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
發生于連線的網路狀態變更時。
public:
static event NetworkStatusChangedEventHandler ^ NetworkStatusChanged;
// Register
static event_token NetworkStatusChanged(NetworkStatusChangedEventHandler const& handler) const;
// Revoke with event_token
static void NetworkStatusChanged(event_token const* cookie) const;
// Revoke with event_revoker
static NetworkInformation::NetworkStatusChanged_revoker NetworkStatusChanged(auto_revoke_t, NetworkStatusChangedEventHandler const& handler) const;
public static event NetworkStatusChangedEventHandler NetworkStatusChanged;
function onNetworkStatusChanged(eventArgs) { /* Your code */ }
Windows.Networking.Connectivity.NetworkInformation.addEventListener("networkstatuschanged", onNetworkStatusChanged);
Windows.Networking.Connectivity.NetworkInformation.removeEventListener("networkstatuschanged", onNetworkStatusChanged);
- or -
Windows.Networking.Connectivity.NetworkInformation.onnetworkstatuschanged = onNetworkStatusChanged;
Public Shared Custom Event NetworkStatusChanged As NetworkStatusChangedEventHandler