PowerManager.PowerSourceKindChanged 事件

定义

当设备的电源发生更改时引发。

// Register
static event_token PowerSourceKindChanged(EventHandler<IInspectable> const& handler) const;

// Revoke with event_token
static void PowerSourceKindChanged(event_token const* cookie) const;

// Revoke with event_revoker
static PowerManager::PowerSourceKindChanged_revoker PowerSourceKindChanged(auto_revoke_t, EventHandler<IInspectable> const& handler) const;
public static event System.EventHandler<object> PowerSourceKindChanged;
function onPowerSourceKindChanged(eventArgs) { /* Your code */ }
Microsoft.Windows.System.Power.PowerManager.addEventListener("powersourcekindchanged", onPowerSourceKindChanged);
Microsoft.Windows.System.Power.PowerManager.removeEventListener("powersourcekindchanged", onPowerSourceKindChanged);
- or -
Microsoft.Windows.System.Power.PowerManager.onpowersourcekindchanged = onPowerSourceKindChanged;
Public Shared Custom Event PowerSourceKindChanged As EventHandler(Of Object) 

事件类型

注解

若要获取设备的当前电源以响应此事件,请使用 PowerSourceKind 属性。 此事件对应于 GUID_ACDC_POWER_SOURCE电源设置 GUID

适用于

另请参阅