Files
2026-01-27 23:46:02 -08:00

1610 lines
71 KiB
C++

// WARNING: Please don't edit this file. It was generated by C++/WinRT
// v2.0.250303.1
#pragma once
#ifndef WINRT_Microsoft_Windows_System_Power_H
#define WINRT_Microsoft_Windows_System_Power_H
#include "winrt/base.h"
static_assert(winrt::check_version(CPPWINRT_VERSION, "2.0.250303.1"),
"Mismatched C++/WinRT headers.");
#define CPPWINRT_VERSION "2.0.250303.1"
#include "winrt/Microsoft.Windows.System.h"
#include "winrt/impl/Microsoft.Windows.System.Power.2.h"
#include "winrt/impl/Windows.Foundation.2.h"
namespace winrt::impl {
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<
D>::EnergySaverStatus() const {
winrt::Microsoft::Windows::System::Power::EnergySaverStatus value{};
if constexpr (!std::is_same_v<D, winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>) {
winrt::hresult _winrt_cast_result_code;
auto const _winrt_casted_result = impl::try_as_with_reason<
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics,
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
check_hresult(_winrt_cast_result_code);
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)&_winrt_casted_result;
check_hresult(_winrt_abi_type->get_EnergySaverStatus(
reinterpret_cast<int32_t*>(&value)));
} else {
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)this;
check_hresult(_winrt_abi_type->get_EnergySaverStatus(
reinterpret_cast<int32_t*>(&value)));
}
return value;
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<D>::
EnergySaverStatusChanged(
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) const {
winrt::event_token token{};
if constexpr (!std::is_same_v<D, winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>) {
winrt::hresult _winrt_cast_result_code;
auto const _winrt_casted_result = impl::try_as_with_reason<
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics,
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
check_hresult(_winrt_cast_result_code);
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)&_winrt_casted_result;
check_hresult(_winrt_abi_type->add_EnergySaverStatusChanged(
*(void**)(&handler), put_abi(token)));
} else {
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)this;
check_hresult(_winrt_abi_type->add_EnergySaverStatusChanged(
*(void**)(&handler), put_abi(token)));
}
return token;
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<D>::
EnergySaverStatusChanged(
auto_revoke_t,
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) const {
return impl::make_event_revoker<D, EnergySaverStatusChanged_revoker>(
this, EnergySaverStatusChanged(handler));
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<D>::
EnergySaverStatusChanged(winrt::event_token const& token) const noexcept {
if constexpr (!std::is_same_v<D, winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>) {
winrt::hresult _winrt_cast_result_code;
auto const _winrt_casted_result = impl::try_as_with_reason<
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics,
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
check_hresult(_winrt_cast_result_code);
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)&_winrt_casted_result;
_winrt_abi_type->remove_EnergySaverStatusChanged(impl::bind_in(token));
} else {
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)this;
_winrt_abi_type->remove_EnergySaverStatusChanged(impl::bind_in(token));
}
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<
D>::BatteryStatus() const {
winrt::Microsoft::Windows::System::Power::BatteryStatus value{};
if constexpr (!std::is_same_v<D, winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>) {
winrt::hresult _winrt_cast_result_code;
auto const _winrt_casted_result = impl::try_as_with_reason<
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics,
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
check_hresult(_winrt_cast_result_code);
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)&_winrt_casted_result;
check_hresult(
_winrt_abi_type->get_BatteryStatus(reinterpret_cast<int32_t*>(&value)));
} else {
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)this;
check_hresult(
_winrt_abi_type->get_BatteryStatus(reinterpret_cast<int32_t*>(&value)));
}
return value;
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<D>::
BatteryStatusChanged(
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) const {
winrt::event_token token{};
if constexpr (!std::is_same_v<D, winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>) {
winrt::hresult _winrt_cast_result_code;
auto const _winrt_casted_result = impl::try_as_with_reason<
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics,
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
check_hresult(_winrt_cast_result_code);
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)&_winrt_casted_result;
check_hresult(_winrt_abi_type->add_BatteryStatusChanged(*(void**)(&handler),
put_abi(token)));
} else {
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)this;
check_hresult(_winrt_abi_type->add_BatteryStatusChanged(*(void**)(&handler),
put_abi(token)));
}
return token;
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<D>::
BatteryStatusChanged(
auto_revoke_t,
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) const {
return impl::make_event_revoker<D, BatteryStatusChanged_revoker>(
this, BatteryStatusChanged(handler));
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<
D>::BatteryStatusChanged(winrt::event_token const& token) const noexcept {
if constexpr (!std::is_same_v<D, winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>) {
winrt::hresult _winrt_cast_result_code;
auto const _winrt_casted_result = impl::try_as_with_reason<
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics,
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
check_hresult(_winrt_cast_result_code);
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)&_winrt_casted_result;
_winrt_abi_type->remove_BatteryStatusChanged(impl::bind_in(token));
} else {
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)this;
_winrt_abi_type->remove_BatteryStatusChanged(impl::bind_in(token));
}
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<
D>::PowerSupplyStatus() const {
winrt::Microsoft::Windows::System::Power::PowerSupplyStatus value{};
if constexpr (!std::is_same_v<D, winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>) {
winrt::hresult _winrt_cast_result_code;
auto const _winrt_casted_result = impl::try_as_with_reason<
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics,
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
check_hresult(_winrt_cast_result_code);
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)&_winrt_casted_result;
check_hresult(_winrt_abi_type->get_PowerSupplyStatus(
reinterpret_cast<int32_t*>(&value)));
} else {
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)this;
check_hresult(_winrt_abi_type->get_PowerSupplyStatus(
reinterpret_cast<int32_t*>(&value)));
}
return value;
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<D>::
PowerSupplyStatusChanged(
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) const {
winrt::event_token token{};
if constexpr (!std::is_same_v<D, winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>) {
winrt::hresult _winrt_cast_result_code;
auto const _winrt_casted_result = impl::try_as_with_reason<
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics,
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
check_hresult(_winrt_cast_result_code);
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)&_winrt_casted_result;
check_hresult(_winrt_abi_type->add_PowerSupplyStatusChanged(
*(void**)(&handler), put_abi(token)));
} else {
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)this;
check_hresult(_winrt_abi_type->add_PowerSupplyStatusChanged(
*(void**)(&handler), put_abi(token)));
}
return token;
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<D>::
PowerSupplyStatusChanged(
auto_revoke_t,
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) const {
return impl::make_event_revoker<D, PowerSupplyStatusChanged_revoker>(
this, PowerSupplyStatusChanged(handler));
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<D>::
PowerSupplyStatusChanged(winrt::event_token const& token) const noexcept {
if constexpr (!std::is_same_v<D, winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>) {
winrt::hresult _winrt_cast_result_code;
auto const _winrt_casted_result = impl::try_as_with_reason<
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics,
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
check_hresult(_winrt_cast_result_code);
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)&_winrt_casted_result;
_winrt_abi_type->remove_PowerSupplyStatusChanged(impl::bind_in(token));
} else {
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)this;
_winrt_abi_type->remove_PowerSupplyStatusChanged(impl::bind_in(token));
}
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<
D>::RemainingChargePercent() const {
int32_t value{};
if constexpr (!std::is_same_v<D, winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>) {
winrt::hresult _winrt_cast_result_code;
auto const _winrt_casted_result = impl::try_as_with_reason<
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics,
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
check_hresult(_winrt_cast_result_code);
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)&_winrt_casted_result;
check_hresult(_winrt_abi_type->get_RemainingChargePercent(&value));
} else {
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)this;
check_hresult(_winrt_abi_type->get_RemainingChargePercent(&value));
}
return value;
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<D>::
RemainingChargePercentChanged(
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) const {
winrt::event_token token{};
if constexpr (!std::is_same_v<D, winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>) {
winrt::hresult _winrt_cast_result_code;
auto const _winrt_casted_result = impl::try_as_with_reason<
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics,
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
check_hresult(_winrt_cast_result_code);
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)&_winrt_casted_result;
check_hresult(_winrt_abi_type->add_RemainingChargePercentChanged(
*(void**)(&handler), put_abi(token)));
} else {
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)this;
check_hresult(_winrt_abi_type->add_RemainingChargePercentChanged(
*(void**)(&handler), put_abi(token)));
}
return token;
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<D>::
RemainingChargePercentChanged(
auto_revoke_t,
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) const {
return impl::make_event_revoker<D, RemainingChargePercentChanged_revoker>(
this, RemainingChargePercentChanged(handler));
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<
D>::RemainingChargePercentChanged(winrt::event_token const& token)
const noexcept {
if constexpr (!std::is_same_v<D, winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>) {
winrt::hresult _winrt_cast_result_code;
auto const _winrt_casted_result = impl::try_as_with_reason<
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics,
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
check_hresult(_winrt_cast_result_code);
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)&_winrt_casted_result;
_winrt_abi_type->remove_RemainingChargePercentChanged(impl::bind_in(token));
} else {
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)this;
_winrt_abi_type->remove_RemainingChargePercentChanged(impl::bind_in(token));
}
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<
D>::RemainingDischargeTime() const {
winrt::Windows::Foundation::TimeSpan value{};
if constexpr (!std::is_same_v<D, winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>) {
winrt::hresult _winrt_cast_result_code;
auto const _winrt_casted_result = impl::try_as_with_reason<
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics,
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
check_hresult(_winrt_cast_result_code);
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)&_winrt_casted_result;
check_hresult(_winrt_abi_type->get_RemainingDischargeTime(put_abi(value)));
} else {
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)this;
check_hresult(_winrt_abi_type->get_RemainingDischargeTime(put_abi(value)));
}
return value;
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<D>::
RemainingDischargeTimeChanged(
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) const {
winrt::event_token token{};
if constexpr (!std::is_same_v<D, winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>) {
winrt::hresult _winrt_cast_result_code;
auto const _winrt_casted_result = impl::try_as_with_reason<
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics,
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
check_hresult(_winrt_cast_result_code);
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)&_winrt_casted_result;
check_hresult(_winrt_abi_type->add_RemainingDischargeTimeChanged(
*(void**)(&handler), put_abi(token)));
} else {
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)this;
check_hresult(_winrt_abi_type->add_RemainingDischargeTimeChanged(
*(void**)(&handler), put_abi(token)));
}
return token;
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<D>::
RemainingDischargeTimeChanged(
auto_revoke_t,
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) const {
return impl::make_event_revoker<D, RemainingDischargeTimeChanged_revoker>(
this, RemainingDischargeTimeChanged(handler));
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<
D>::RemainingDischargeTimeChanged(winrt::event_token const& token)
const noexcept {
if constexpr (!std::is_same_v<D, winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>) {
winrt::hresult _winrt_cast_result_code;
auto const _winrt_casted_result = impl::try_as_with_reason<
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics,
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
check_hresult(_winrt_cast_result_code);
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)&_winrt_casted_result;
_winrt_abi_type->remove_RemainingDischargeTimeChanged(impl::bind_in(token));
} else {
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)this;
_winrt_abi_type->remove_RemainingDischargeTimeChanged(impl::bind_in(token));
}
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<
D>::PowerSourceKind() const {
winrt::Microsoft::Windows::System::Power::PowerSourceKind value{};
if constexpr (!std::is_same_v<D, winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>) {
winrt::hresult _winrt_cast_result_code;
auto const _winrt_casted_result = impl::try_as_with_reason<
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics,
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
check_hresult(_winrt_cast_result_code);
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)&_winrt_casted_result;
check_hresult(_winrt_abi_type->get_PowerSourceKind(
reinterpret_cast<int32_t*>(&value)));
} else {
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)this;
check_hresult(_winrt_abi_type->get_PowerSourceKind(
reinterpret_cast<int32_t*>(&value)));
}
return value;
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<D>::
PowerSourceKindChanged(
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) const {
winrt::event_token token{};
if constexpr (!std::is_same_v<D, winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>) {
winrt::hresult _winrt_cast_result_code;
auto const _winrt_casted_result = impl::try_as_with_reason<
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics,
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
check_hresult(_winrt_cast_result_code);
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)&_winrt_casted_result;
check_hresult(_winrt_abi_type->add_PowerSourceKindChanged(
*(void**)(&handler), put_abi(token)));
} else {
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)this;
check_hresult(_winrt_abi_type->add_PowerSourceKindChanged(
*(void**)(&handler), put_abi(token)));
}
return token;
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<D>::
PowerSourceKindChanged(
auto_revoke_t,
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) const {
return impl::make_event_revoker<D, PowerSourceKindChanged_revoker>(
this, PowerSourceKindChanged(handler));
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<
D>::PowerSourceKindChanged(winrt::event_token const& token) const noexcept {
if constexpr (!std::is_same_v<D, winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>) {
winrt::hresult _winrt_cast_result_code;
auto const _winrt_casted_result = impl::try_as_with_reason<
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics,
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
check_hresult(_winrt_cast_result_code);
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)&_winrt_casted_result;
_winrt_abi_type->remove_PowerSourceKindChanged(impl::bind_in(token));
} else {
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)this;
_winrt_abi_type->remove_PowerSourceKindChanged(impl::bind_in(token));
}
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<
D>::DisplayStatus() const {
winrt::Microsoft::Windows::System::Power::DisplayStatus value{};
if constexpr (!std::is_same_v<D, winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>) {
winrt::hresult _winrt_cast_result_code;
auto const _winrt_casted_result = impl::try_as_with_reason<
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics,
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
check_hresult(_winrt_cast_result_code);
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)&_winrt_casted_result;
check_hresult(
_winrt_abi_type->get_DisplayStatus(reinterpret_cast<int32_t*>(&value)));
} else {
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)this;
check_hresult(
_winrt_abi_type->get_DisplayStatus(reinterpret_cast<int32_t*>(&value)));
}
return value;
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<D>::
DisplayStatusChanged(
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) const {
winrt::event_token token{};
if constexpr (!std::is_same_v<D, winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>) {
winrt::hresult _winrt_cast_result_code;
auto const _winrt_casted_result = impl::try_as_with_reason<
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics,
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
check_hresult(_winrt_cast_result_code);
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)&_winrt_casted_result;
check_hresult(_winrt_abi_type->add_DisplayStatusChanged(*(void**)(&handler),
put_abi(token)));
} else {
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)this;
check_hresult(_winrt_abi_type->add_DisplayStatusChanged(*(void**)(&handler),
put_abi(token)));
}
return token;
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<D>::
DisplayStatusChanged(
auto_revoke_t,
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) const {
return impl::make_event_revoker<D, DisplayStatusChanged_revoker>(
this, DisplayStatusChanged(handler));
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<
D>::DisplayStatusChanged(winrt::event_token const& token) const noexcept {
if constexpr (!std::is_same_v<D, winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>) {
winrt::hresult _winrt_cast_result_code;
auto const _winrt_casted_result = impl::try_as_with_reason<
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics,
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
check_hresult(_winrt_cast_result_code);
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)&_winrt_casted_result;
_winrt_abi_type->remove_DisplayStatusChanged(impl::bind_in(token));
} else {
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)this;
_winrt_abi_type->remove_DisplayStatusChanged(impl::bind_in(token));
}
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<D>::
SystemIdleStatusChanged(
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) const {
winrt::event_token token{};
if constexpr (!std::is_same_v<D, winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>) {
winrt::hresult _winrt_cast_result_code;
auto const _winrt_casted_result = impl::try_as_with_reason<
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics,
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
check_hresult(_winrt_cast_result_code);
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)&_winrt_casted_result;
check_hresult(_winrt_abi_type->add_SystemIdleStatusChanged(
*(void**)(&handler), put_abi(token)));
} else {
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)this;
check_hresult(_winrt_abi_type->add_SystemIdleStatusChanged(
*(void**)(&handler), put_abi(token)));
}
return token;
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<D>::
SystemIdleStatusChanged(
auto_revoke_t,
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) const {
return impl::make_event_revoker<D, SystemIdleStatusChanged_revoker>(
this, SystemIdleStatusChanged(handler));
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<D>::
SystemIdleStatusChanged(winrt::event_token const& token) const noexcept {
if constexpr (!std::is_same_v<D, winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>) {
winrt::hresult _winrt_cast_result_code;
auto const _winrt_casted_result = impl::try_as_with_reason<
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics,
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
check_hresult(_winrt_cast_result_code);
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)&_winrt_casted_result;
_winrt_abi_type->remove_SystemIdleStatusChanged(impl::bind_in(token));
} else {
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)this;
_winrt_abi_type->remove_SystemIdleStatusChanged(impl::bind_in(token));
}
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<
D>::EffectivePowerMode() const {
void* value{};
if constexpr (!std::is_same_v<D, winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>) {
winrt::hresult _winrt_cast_result_code;
auto const _winrt_casted_result = impl::try_as_with_reason<
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics,
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
check_hresult(_winrt_cast_result_code);
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)&_winrt_casted_result;
check_hresult(_winrt_abi_type->get_EffectivePowerMode(&value));
} else {
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)this;
check_hresult(_winrt_abi_type->get_EffectivePowerMode(&value));
}
return winrt::Windows::Foundation::IAsyncOperation<
winrt::Microsoft::Windows::System::Power::EffectivePowerMode>{
value, take_ownership_from_abi};
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<D>::
EffectivePowerModeChanged(
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) const {
winrt::event_token token{};
if constexpr (!std::is_same_v<D, winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>) {
winrt::hresult _winrt_cast_result_code;
auto const _winrt_casted_result = impl::try_as_with_reason<
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics,
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
check_hresult(_winrt_cast_result_code);
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)&_winrt_casted_result;
check_hresult(_winrt_abi_type->add_EffectivePowerModeChanged(
*(void**)(&handler), put_abi(token)));
} else {
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)this;
check_hresult(_winrt_abi_type->add_EffectivePowerModeChanged(
*(void**)(&handler), put_abi(token)));
}
return token;
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<D>::
EffectivePowerModeChanged(
auto_revoke_t,
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) const {
return impl::make_event_revoker<D, EffectivePowerModeChanged_revoker>(
this, EffectivePowerModeChanged(handler));
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<D>::
EffectivePowerModeChanged(winrt::event_token const& token) const noexcept {
if constexpr (!std::is_same_v<D, winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>) {
winrt::hresult _winrt_cast_result_code;
auto const _winrt_casted_result = impl::try_as_with_reason<
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics,
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
check_hresult(_winrt_cast_result_code);
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)&_winrt_casted_result;
_winrt_abi_type->remove_EffectivePowerModeChanged(impl::bind_in(token));
} else {
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)this;
_winrt_abi_type->remove_EffectivePowerModeChanged(impl::bind_in(token));
}
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<
D>::UserPresenceStatus() const {
winrt::Microsoft::Windows::System::Power::UserPresenceStatus value{};
if constexpr (!std::is_same_v<D, winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>) {
winrt::hresult _winrt_cast_result_code;
auto const _winrt_casted_result = impl::try_as_with_reason<
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics,
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
check_hresult(_winrt_cast_result_code);
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)&_winrt_casted_result;
check_hresult(_winrt_abi_type->get_UserPresenceStatus(
reinterpret_cast<int32_t*>(&value)));
} else {
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)this;
check_hresult(_winrt_abi_type->get_UserPresenceStatus(
reinterpret_cast<int32_t*>(&value)));
}
return value;
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<D>::
UserPresenceStatusChanged(
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) const {
winrt::event_token token{};
if constexpr (!std::is_same_v<D, winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>) {
winrt::hresult _winrt_cast_result_code;
auto const _winrt_casted_result = impl::try_as_with_reason<
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics,
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
check_hresult(_winrt_cast_result_code);
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)&_winrt_casted_result;
check_hresult(_winrt_abi_type->add_UserPresenceStatusChanged(
*(void**)(&handler), put_abi(token)));
} else {
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)this;
check_hresult(_winrt_abi_type->add_UserPresenceStatusChanged(
*(void**)(&handler), put_abi(token)));
}
return token;
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<D>::
UserPresenceStatusChanged(
auto_revoke_t,
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) const {
return impl::make_event_revoker<D, UserPresenceStatusChanged_revoker>(
this, UserPresenceStatusChanged(handler));
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<D>::
UserPresenceStatusChanged(winrt::event_token const& token) const noexcept {
if constexpr (!std::is_same_v<D, winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>) {
winrt::hresult _winrt_cast_result_code;
auto const _winrt_casted_result = impl::try_as_with_reason<
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics,
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
check_hresult(_winrt_cast_result_code);
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)&_winrt_casted_result;
_winrt_abi_type->remove_UserPresenceStatusChanged(impl::bind_in(token));
} else {
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)this;
_winrt_abi_type->remove_UserPresenceStatusChanged(impl::bind_in(token));
}
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<
D>::SystemSuspendStatus() const {
winrt::Microsoft::Windows::System::Power::SystemSuspendStatus value{};
if constexpr (!std::is_same_v<D, winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>) {
winrt::hresult _winrt_cast_result_code;
auto const _winrt_casted_result = impl::try_as_with_reason<
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics,
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
check_hresult(_winrt_cast_result_code);
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)&_winrt_casted_result;
check_hresult(_winrt_abi_type->get_SystemSuspendStatus(
reinterpret_cast<int32_t*>(&value)));
} else {
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)this;
check_hresult(_winrt_abi_type->get_SystemSuspendStatus(
reinterpret_cast<int32_t*>(&value)));
}
return value;
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<D>::
SystemSuspendStatusChanged(
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) const {
winrt::event_token token{};
if constexpr (!std::is_same_v<D, winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>) {
winrt::hresult _winrt_cast_result_code;
auto const _winrt_casted_result = impl::try_as_with_reason<
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics,
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
check_hresult(_winrt_cast_result_code);
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)&_winrt_casted_result;
check_hresult(_winrt_abi_type->add_SystemSuspendStatusChanged(
*(void**)(&handler), put_abi(token)));
} else {
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)this;
check_hresult(_winrt_abi_type->add_SystemSuspendStatusChanged(
*(void**)(&handler), put_abi(token)));
}
return token;
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<D>::
SystemSuspendStatusChanged(
auto_revoke_t,
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) const {
return impl::make_event_revoker<D, SystemSuspendStatusChanged_revoker>(
this, SystemSuspendStatusChanged(handler));
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics<D>::
SystemSuspendStatusChanged(winrt::event_token const& token) const noexcept {
if constexpr (!std::is_same_v<D, winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>) {
winrt::hresult _winrt_cast_result_code;
auto const _winrt_casted_result = impl::try_as_with_reason<
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics,
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
check_hresult(_winrt_cast_result_code);
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)&_winrt_casted_result;
_winrt_abi_type->remove_SystemSuspendStatusChanged(impl::bind_in(token));
} else {
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics>**)this;
_winrt_abi_type->remove_SystemSuspendStatusChanged(impl::bind_in(token));
}
}
template <typename D>
auto consume_Microsoft_Windows_System_Power_IPowerManagerStatics2<
D>::EffectivePowerMode2() const {
winrt::Microsoft::Windows::System::Power::EffectivePowerMode value{};
if constexpr (!std::is_same_v<D, winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics2>) {
winrt::hresult _winrt_cast_result_code;
auto const _winrt_casted_result = impl::try_as_with_reason<
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics2,
D const*>(static_cast<D const*>(this), _winrt_cast_result_code);
check_hresult(_winrt_cast_result_code);
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics2>**)&_winrt_casted_result;
check_hresult(_winrt_abi_type->get_EffectivePowerMode2(
reinterpret_cast<int32_t*>(&value)));
} else {
auto const _winrt_abi_type =
*(abi_t<winrt::Microsoft::Windows::System::Power::
IPowerManagerStatics2>**)this;
check_hresult(_winrt_abi_type->get_EffectivePowerMode2(
reinterpret_cast<int32_t*>(&value)));
}
return value;
}
#ifndef WINRT_LEAN_AND_MEAN
template <typename D>
struct produce<D,
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics>
: produce_base<
D, winrt::Microsoft::Windows::System::Power::IPowerManagerStatics> {
int32_t __stdcall get_EnergySaverStatus(int32_t* value) noexcept final try {
typename D::abi_guard guard(this->shim());
*value = detach_from<
winrt::Microsoft::Windows::System::Power::EnergySaverStatus>(
this->shim().EnergySaverStatus());
return 0;
} catch (...) {
return to_hresult();
}
int32_t __stdcall add_EnergySaverStatusChanged(
void* handler, winrt::event_token* token) noexcept final try {
zero_abi<winrt::event_token>(token);
typename D::abi_guard guard(this->shim());
*token =
detach_from<winrt::event_token>(this->shim().EnergySaverStatusChanged(
*reinterpret_cast<winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const*>(&handler)));
return 0;
} catch (...) {
return to_hresult();
}
int32_t __stdcall remove_EnergySaverStatusChanged(
winrt::event_token token) noexcept final {
typename D::abi_guard guard(this->shim());
this->shim().EnergySaverStatusChanged(
*reinterpret_cast<winrt::event_token const*>(&token));
return 0;
}
int32_t __stdcall get_BatteryStatus(int32_t* value) noexcept final try {
typename D::abi_guard guard(this->shim());
*value =
detach_from<winrt::Microsoft::Windows::System::Power::BatteryStatus>(
this->shim().BatteryStatus());
return 0;
} catch (...) {
return to_hresult();
}
int32_t __stdcall add_BatteryStatusChanged(
void* handler, winrt::event_token* token) noexcept final try {
zero_abi<winrt::event_token>(token);
typename D::abi_guard guard(this->shim());
*token = detach_from<winrt::event_token>(this->shim().BatteryStatusChanged(
*reinterpret_cast<winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const*>(&handler)));
return 0;
} catch (...) {
return to_hresult();
}
int32_t __stdcall remove_BatteryStatusChanged(
winrt::event_token token) noexcept final {
typename D::abi_guard guard(this->shim());
this->shim().BatteryStatusChanged(
*reinterpret_cast<winrt::event_token const*>(&token));
return 0;
}
int32_t __stdcall get_PowerSupplyStatus(int32_t* value) noexcept final try {
typename D::abi_guard guard(this->shim());
*value = detach_from<
winrt::Microsoft::Windows::System::Power::PowerSupplyStatus>(
this->shim().PowerSupplyStatus());
return 0;
} catch (...) {
return to_hresult();
}
int32_t __stdcall add_PowerSupplyStatusChanged(
void* handler, winrt::event_token* token) noexcept final try {
zero_abi<winrt::event_token>(token);
typename D::abi_guard guard(this->shim());
*token =
detach_from<winrt::event_token>(this->shim().PowerSupplyStatusChanged(
*reinterpret_cast<winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const*>(&handler)));
return 0;
} catch (...) {
return to_hresult();
}
int32_t __stdcall remove_PowerSupplyStatusChanged(
winrt::event_token token) noexcept final {
typename D::abi_guard guard(this->shim());
this->shim().PowerSupplyStatusChanged(
*reinterpret_cast<winrt::event_token const*>(&token));
return 0;
}
int32_t __stdcall get_RemainingChargePercent(int32_t* value) noexcept final
try {
typename D::abi_guard guard(this->shim());
*value = detach_from<int32_t>(this->shim().RemainingChargePercent());
return 0;
} catch (...) {
return to_hresult();
}
int32_t __stdcall add_RemainingChargePercentChanged(
void* handler, winrt::event_token* token) noexcept final try {
zero_abi<winrt::event_token>(token);
typename D::abi_guard guard(this->shim());
*token = detach_from<winrt::event_token>(
this->shim().RemainingChargePercentChanged(
*reinterpret_cast<winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const*>(&handler)));
return 0;
} catch (...) {
return to_hresult();
}
int32_t __stdcall remove_RemainingChargePercentChanged(
winrt::event_token token) noexcept final {
typename D::abi_guard guard(this->shim());
this->shim().RemainingChargePercentChanged(
*reinterpret_cast<winrt::event_token const*>(&token));
return 0;
}
int32_t __stdcall get_RemainingDischargeTime(int64_t* value) noexcept final
try {
zero_abi<winrt::Windows::Foundation::TimeSpan>(value);
typename D::abi_guard guard(this->shim());
*value = detach_from<winrt::Windows::Foundation::TimeSpan>(
this->shim().RemainingDischargeTime());
return 0;
} catch (...) {
return to_hresult();
}
int32_t __stdcall add_RemainingDischargeTimeChanged(
void* handler, winrt::event_token* token) noexcept final try {
zero_abi<winrt::event_token>(token);
typename D::abi_guard guard(this->shim());
*token = detach_from<winrt::event_token>(
this->shim().RemainingDischargeTimeChanged(
*reinterpret_cast<winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const*>(&handler)));
return 0;
} catch (...) {
return to_hresult();
}
int32_t __stdcall remove_RemainingDischargeTimeChanged(
winrt::event_token token) noexcept final {
typename D::abi_guard guard(this->shim());
this->shim().RemainingDischargeTimeChanged(
*reinterpret_cast<winrt::event_token const*>(&token));
return 0;
}
int32_t __stdcall get_PowerSourceKind(int32_t* value) noexcept final try {
typename D::abi_guard guard(this->shim());
*value =
detach_from<winrt::Microsoft::Windows::System::Power::PowerSourceKind>(
this->shim().PowerSourceKind());
return 0;
} catch (...) {
return to_hresult();
}
int32_t __stdcall add_PowerSourceKindChanged(
void* handler, winrt::event_token* token) noexcept final try {
zero_abi<winrt::event_token>(token);
typename D::abi_guard guard(this->shim());
*token =
detach_from<winrt::event_token>(this->shim().PowerSourceKindChanged(
*reinterpret_cast<winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const*>(&handler)));
return 0;
} catch (...) {
return to_hresult();
}
int32_t __stdcall remove_PowerSourceKindChanged(
winrt::event_token token) noexcept final {
typename D::abi_guard guard(this->shim());
this->shim().PowerSourceKindChanged(
*reinterpret_cast<winrt::event_token const*>(&token));
return 0;
}
int32_t __stdcall get_DisplayStatus(int32_t* value) noexcept final try {
typename D::abi_guard guard(this->shim());
*value =
detach_from<winrt::Microsoft::Windows::System::Power::DisplayStatus>(
this->shim().DisplayStatus());
return 0;
} catch (...) {
return to_hresult();
}
int32_t __stdcall add_DisplayStatusChanged(
void* handler, winrt::event_token* token) noexcept final try {
zero_abi<winrt::event_token>(token);
typename D::abi_guard guard(this->shim());
*token = detach_from<winrt::event_token>(this->shim().DisplayStatusChanged(
*reinterpret_cast<winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const*>(&handler)));
return 0;
} catch (...) {
return to_hresult();
}
int32_t __stdcall remove_DisplayStatusChanged(
winrt::event_token token) noexcept final {
typename D::abi_guard guard(this->shim());
this->shim().DisplayStatusChanged(
*reinterpret_cast<winrt::event_token const*>(&token));
return 0;
}
int32_t __stdcall add_SystemIdleStatusChanged(
void* handler, winrt::event_token* token) noexcept final try {
zero_abi<winrt::event_token>(token);
typename D::abi_guard guard(this->shim());
*token =
detach_from<winrt::event_token>(this->shim().SystemIdleStatusChanged(
*reinterpret_cast<winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const*>(&handler)));
return 0;
} catch (...) {
return to_hresult();
}
int32_t __stdcall remove_SystemIdleStatusChanged(
winrt::event_token token) noexcept final {
typename D::abi_guard guard(this->shim());
this->shim().SystemIdleStatusChanged(
*reinterpret_cast<winrt::event_token const*>(&token));
return 0;
}
int32_t __stdcall get_EffectivePowerMode(void** value) noexcept final try {
clear_abi(value);
typename D::abi_guard guard(this->shim());
*value = detach_from<winrt::Windows::Foundation::IAsyncOperation<
winrt::Microsoft::Windows::System::Power::EffectivePowerMode>>(
this->shim().EffectivePowerMode());
return 0;
} catch (...) {
return to_hresult();
}
int32_t __stdcall add_EffectivePowerModeChanged(
void* handler, winrt::event_token* token) noexcept final try {
zero_abi<winrt::event_token>(token);
typename D::abi_guard guard(this->shim());
*token =
detach_from<winrt::event_token>(this->shim().EffectivePowerModeChanged(
*reinterpret_cast<winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const*>(&handler)));
return 0;
} catch (...) {
return to_hresult();
}
int32_t __stdcall remove_EffectivePowerModeChanged(
winrt::event_token token) noexcept final {
typename D::abi_guard guard(this->shim());
this->shim().EffectivePowerModeChanged(
*reinterpret_cast<winrt::event_token const*>(&token));
return 0;
}
int32_t __stdcall get_UserPresenceStatus(int32_t* value) noexcept final try {
typename D::abi_guard guard(this->shim());
*value = detach_from<
winrt::Microsoft::Windows::System::Power::UserPresenceStatus>(
this->shim().UserPresenceStatus());
return 0;
} catch (...) {
return to_hresult();
}
int32_t __stdcall add_UserPresenceStatusChanged(
void* handler, winrt::event_token* token) noexcept final try {
zero_abi<winrt::event_token>(token);
typename D::abi_guard guard(this->shim());
*token =
detach_from<winrt::event_token>(this->shim().UserPresenceStatusChanged(
*reinterpret_cast<winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const*>(&handler)));
return 0;
} catch (...) {
return to_hresult();
}
int32_t __stdcall remove_UserPresenceStatusChanged(
winrt::event_token token) noexcept final {
typename D::abi_guard guard(this->shim());
this->shim().UserPresenceStatusChanged(
*reinterpret_cast<winrt::event_token const*>(&token));
return 0;
}
int32_t __stdcall get_SystemSuspendStatus(int32_t* value) noexcept final try {
typename D::abi_guard guard(this->shim());
*value = detach_from<
winrt::Microsoft::Windows::System::Power::SystemSuspendStatus>(
this->shim().SystemSuspendStatus());
return 0;
} catch (...) {
return to_hresult();
}
int32_t __stdcall add_SystemSuspendStatusChanged(
void* handler, winrt::event_token* token) noexcept final try {
zero_abi<winrt::event_token>(token);
typename D::abi_guard guard(this->shim());
*token =
detach_from<winrt::event_token>(this->shim().SystemSuspendStatusChanged(
*reinterpret_cast<winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const*>(&handler)));
return 0;
} catch (...) {
return to_hresult();
}
int32_t __stdcall remove_SystemSuspendStatusChanged(
winrt::event_token token) noexcept final {
typename D::abi_guard guard(this->shim());
this->shim().SystemSuspendStatusChanged(
*reinterpret_cast<winrt::event_token const*>(&token));
return 0;
}
};
#endif
#ifndef WINRT_LEAN_AND_MEAN
template <typename D>
struct produce<D,
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics2>
: produce_base<
D, winrt::Microsoft::Windows::System::Power::IPowerManagerStatics2> {
int32_t __stdcall get_EffectivePowerMode2(int32_t* value) noexcept final try {
typename D::abi_guard guard(this->shim());
*value = detach_from<
winrt::Microsoft::Windows::System::Power::EffectivePowerMode>(
this->shim().EffectivePowerMode2());
return 0;
} catch (...) {
return to_hresult();
}
};
#endif
} // namespace winrt::impl
WINRT_EXPORT namespace winrt::Microsoft::Windows::System::Power {
inline auto PowerManager::EnergySaverStatus() {
return impl::call_factory_cast<
winrt::Microsoft::Windows::System::Power::EnergySaverStatus (*)(
IPowerManagerStatics const&),
PowerManager, IPowerManagerStatics>(
[](IPowerManagerStatics const& f) { return f.EnergySaverStatus(); });
}
inline auto PowerManager::EnergySaverStatusChanged(
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) {
return impl::call_factory<PowerManager, IPowerManagerStatics>(
[&](IPowerManagerStatics const& f) {
return f.EnergySaverStatusChanged(handler);
});
}
inline auto PowerManager::EnergySaverStatusChanged(
auto_revoke_t,
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) {
auto f = get_activation_factory<
PowerManager,
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics>();
return PowerManager::EnergySaverStatusChanged_revoker{
f, f.EnergySaverStatusChanged(handler)};
}
inline auto PowerManager::EnergySaverStatusChanged(
winrt::event_token const& token) {
impl::call_factory<PowerManager, IPowerManagerStatics>(
[&](IPowerManagerStatics const& f) {
return f.EnergySaverStatusChanged(token);
});
}
inline auto PowerManager::BatteryStatus() {
return impl::call_factory_cast<
winrt::Microsoft::Windows::System::Power::BatteryStatus (*)(
IPowerManagerStatics const&),
PowerManager, IPowerManagerStatics>(
[](IPowerManagerStatics const& f) { return f.BatteryStatus(); });
}
inline auto PowerManager::BatteryStatusChanged(
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) {
return impl::call_factory<PowerManager, IPowerManagerStatics>(
[&](IPowerManagerStatics const& f) {
return f.BatteryStatusChanged(handler);
});
}
inline auto PowerManager::BatteryStatusChanged(
auto_revoke_t,
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) {
auto f = get_activation_factory<
PowerManager,
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics>();
return PowerManager::BatteryStatusChanged_revoker{
f, f.BatteryStatusChanged(handler)};
}
inline auto PowerManager::BatteryStatusChanged(
winrt::event_token const& token) {
impl::call_factory<PowerManager, IPowerManagerStatics>(
[&](IPowerManagerStatics const& f) {
return f.BatteryStatusChanged(token);
});
}
inline auto PowerManager::PowerSupplyStatus() {
return impl::call_factory_cast<
winrt::Microsoft::Windows::System::Power::PowerSupplyStatus (*)(
IPowerManagerStatics const&),
PowerManager, IPowerManagerStatics>(
[](IPowerManagerStatics const& f) { return f.PowerSupplyStatus(); });
}
inline auto PowerManager::PowerSupplyStatusChanged(
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) {
return impl::call_factory<PowerManager, IPowerManagerStatics>(
[&](IPowerManagerStatics const& f) {
return f.PowerSupplyStatusChanged(handler);
});
}
inline auto PowerManager::PowerSupplyStatusChanged(
auto_revoke_t,
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) {
auto f = get_activation_factory<
PowerManager,
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics>();
return PowerManager::PowerSupplyStatusChanged_revoker{
f, f.PowerSupplyStatusChanged(handler)};
}
inline auto PowerManager::PowerSupplyStatusChanged(
winrt::event_token const& token) {
impl::call_factory<PowerManager, IPowerManagerStatics>(
[&](IPowerManagerStatics const& f) {
return f.PowerSupplyStatusChanged(token);
});
}
inline auto PowerManager::RemainingChargePercent() {
return impl::call_factory_cast<int32_t (*)(IPowerManagerStatics const&),
PowerManager, IPowerManagerStatics>(
[](IPowerManagerStatics const& f) {
return f.RemainingChargePercent();
});
}
inline auto PowerManager::RemainingChargePercentChanged(
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) {
return impl::call_factory<PowerManager, IPowerManagerStatics>(
[&](IPowerManagerStatics const& f) {
return f.RemainingChargePercentChanged(handler);
});
}
inline auto PowerManager::RemainingChargePercentChanged(
auto_revoke_t,
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) {
auto f = get_activation_factory<
PowerManager,
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics>();
return PowerManager::RemainingChargePercentChanged_revoker{
f, f.RemainingChargePercentChanged(handler)};
}
inline auto PowerManager::RemainingChargePercentChanged(
winrt::event_token const& token) {
impl::call_factory<PowerManager, IPowerManagerStatics>(
[&](IPowerManagerStatics const& f) {
return f.RemainingChargePercentChanged(token);
});
}
inline auto PowerManager::RemainingDischargeTime() {
return impl::call_factory_cast<
winrt::Windows::Foundation::TimeSpan (*)(IPowerManagerStatics const&),
PowerManager, IPowerManagerStatics>([](IPowerManagerStatics const& f) {
return f.RemainingDischargeTime();
});
}
inline auto PowerManager::RemainingDischargeTimeChanged(
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) {
return impl::call_factory<PowerManager, IPowerManagerStatics>(
[&](IPowerManagerStatics const& f) {
return f.RemainingDischargeTimeChanged(handler);
});
}
inline auto PowerManager::RemainingDischargeTimeChanged(
auto_revoke_t,
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) {
auto f = get_activation_factory<
PowerManager,
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics>();
return PowerManager::RemainingDischargeTimeChanged_revoker{
f, f.RemainingDischargeTimeChanged(handler)};
}
inline auto PowerManager::RemainingDischargeTimeChanged(
winrt::event_token const& token) {
impl::call_factory<PowerManager, IPowerManagerStatics>(
[&](IPowerManagerStatics const& f) {
return f.RemainingDischargeTimeChanged(token);
});
}
inline auto PowerManager::PowerSourceKind() {
return impl::call_factory_cast<
winrt::Microsoft::Windows::System::Power::PowerSourceKind (*)(
IPowerManagerStatics const&),
PowerManager, IPowerManagerStatics>(
[](IPowerManagerStatics const& f) { return f.PowerSourceKind(); });
}
inline auto PowerManager::PowerSourceKindChanged(
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) {
return impl::call_factory<PowerManager, IPowerManagerStatics>(
[&](IPowerManagerStatics const& f) {
return f.PowerSourceKindChanged(handler);
});
}
inline auto PowerManager::PowerSourceKindChanged(
auto_revoke_t,
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) {
auto f = get_activation_factory<
PowerManager,
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics>();
return PowerManager::PowerSourceKindChanged_revoker{
f, f.PowerSourceKindChanged(handler)};
}
inline auto PowerManager::PowerSourceKindChanged(
winrt::event_token const& token) {
impl::call_factory<PowerManager, IPowerManagerStatics>(
[&](IPowerManagerStatics const& f) {
return f.PowerSourceKindChanged(token);
});
}
inline auto PowerManager::DisplayStatus() {
return impl::call_factory_cast<
winrt::Microsoft::Windows::System::Power::DisplayStatus (*)(
IPowerManagerStatics const&),
PowerManager, IPowerManagerStatics>(
[](IPowerManagerStatics const& f) { return f.DisplayStatus(); });
}
inline auto PowerManager::DisplayStatusChanged(
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) {
return impl::call_factory<PowerManager, IPowerManagerStatics>(
[&](IPowerManagerStatics const& f) {
return f.DisplayStatusChanged(handler);
});
}
inline auto PowerManager::DisplayStatusChanged(
auto_revoke_t,
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) {
auto f = get_activation_factory<
PowerManager,
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics>();
return PowerManager::DisplayStatusChanged_revoker{
f, f.DisplayStatusChanged(handler)};
}
inline auto PowerManager::DisplayStatusChanged(
winrt::event_token const& token) {
impl::call_factory<PowerManager, IPowerManagerStatics>(
[&](IPowerManagerStatics const& f) {
return f.DisplayStatusChanged(token);
});
}
inline auto PowerManager::SystemIdleStatusChanged(
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) {
return impl::call_factory<PowerManager, IPowerManagerStatics>(
[&](IPowerManagerStatics const& f) {
return f.SystemIdleStatusChanged(handler);
});
}
inline auto PowerManager::SystemIdleStatusChanged(
auto_revoke_t,
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) {
auto f = get_activation_factory<
PowerManager,
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics>();
return PowerManager::SystemIdleStatusChanged_revoker{
f, f.SystemIdleStatusChanged(handler)};
}
inline auto PowerManager::SystemIdleStatusChanged(
winrt::event_token const& token) {
impl::call_factory<PowerManager, IPowerManagerStatics>(
[&](IPowerManagerStatics const& f) {
return f.SystemIdleStatusChanged(token);
});
}
inline auto PowerManager::EffectivePowerMode() {
return impl::call_factory_cast<
winrt::Windows::Foundation::IAsyncOperation<
winrt::Microsoft::Windows::System::Power::EffectivePowerMode> (*)(
IPowerManagerStatics const&),
PowerManager, IPowerManagerStatics>(
[](IPowerManagerStatics const& f) { return f.EffectivePowerMode(); });
}
inline auto PowerManager::EffectivePowerModeChanged(
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) {
return impl::call_factory<PowerManager, IPowerManagerStatics>(
[&](IPowerManagerStatics const& f) {
return f.EffectivePowerModeChanged(handler);
});
}
inline auto PowerManager::EffectivePowerModeChanged(
auto_revoke_t,
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) {
auto f = get_activation_factory<
PowerManager,
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics>();
return PowerManager::EffectivePowerModeChanged_revoker{
f, f.EffectivePowerModeChanged(handler)};
}
inline auto PowerManager::EffectivePowerModeChanged(
winrt::event_token const& token) {
impl::call_factory<PowerManager, IPowerManagerStatics>(
[&](IPowerManagerStatics const& f) {
return f.EffectivePowerModeChanged(token);
});
}
inline auto PowerManager::UserPresenceStatus() {
return impl::call_factory_cast<
winrt::Microsoft::Windows::System::Power::UserPresenceStatus (*)(
IPowerManagerStatics const&),
PowerManager, IPowerManagerStatics>(
[](IPowerManagerStatics const& f) { return f.UserPresenceStatus(); });
}
inline auto PowerManager::UserPresenceStatusChanged(
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) {
return impl::call_factory<PowerManager, IPowerManagerStatics>(
[&](IPowerManagerStatics const& f) {
return f.UserPresenceStatusChanged(handler);
});
}
inline auto PowerManager::UserPresenceStatusChanged(
auto_revoke_t,
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) {
auto f = get_activation_factory<
PowerManager,
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics>();
return PowerManager::UserPresenceStatusChanged_revoker{
f, f.UserPresenceStatusChanged(handler)};
}
inline auto PowerManager::UserPresenceStatusChanged(
winrt::event_token const& token) {
impl::call_factory<PowerManager, IPowerManagerStatics>(
[&](IPowerManagerStatics const& f) {
return f.UserPresenceStatusChanged(token);
});
}
inline auto PowerManager::SystemSuspendStatus() {
return impl::call_factory_cast<
winrt::Microsoft::Windows::System::Power::SystemSuspendStatus (*)(
IPowerManagerStatics const&),
PowerManager, IPowerManagerStatics>(
[](IPowerManagerStatics const& f) { return f.SystemSuspendStatus(); });
}
inline auto PowerManager::SystemSuspendStatusChanged(
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) {
return impl::call_factory<PowerManager, IPowerManagerStatics>(
[&](IPowerManagerStatics const& f) {
return f.SystemSuspendStatusChanged(handler);
});
}
inline auto PowerManager::SystemSuspendStatusChanged(
auto_revoke_t,
winrt::Windows::Foundation::EventHandler<
winrt::Windows::Foundation::IInspectable> const& handler) {
auto f = get_activation_factory<
PowerManager,
winrt::Microsoft::Windows::System::Power::IPowerManagerStatics>();
return PowerManager::SystemSuspendStatusChanged_revoker{
f, f.SystemSuspendStatusChanged(handler)};
}
inline auto PowerManager::SystemSuspendStatusChanged(
winrt::event_token const& token) {
impl::call_factory<PowerManager, IPowerManagerStatics>(
[&](IPowerManagerStatics const& f) {
return f.SystemSuspendStatusChanged(token);
});
}
inline auto PowerManager::EffectivePowerMode2() {
return impl::call_factory_cast<
winrt::Microsoft::Windows::System::Power::EffectivePowerMode (*)(
IPowerManagerStatics2 const&),
PowerManager, IPowerManagerStatics2>(
[](IPowerManagerStatics2 const& f) { return f.EffectivePowerMode2(); });
}
}
namespace std {
#ifndef WINRT_LEAN_AND_MEAN
template <>
struct hash<winrt::Microsoft::Windows::System::Power::IPowerManagerStatics>
: winrt::impl::hash_base {};
template <>
struct hash<winrt::Microsoft::Windows::System::Power::IPowerManagerStatics2>
: winrt::impl::hash_base {};
template <>
struct hash<winrt::Microsoft::Windows::System::Power::PowerManager>
: winrt::impl::hash_base {};
#endif
#ifdef __cpp_lib_format
#endif
} // namespace std
#endif