FlightStick.HeadsetDisconnected 事件
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
當頭戴式裝置與飛行杆中斷連線時發出訊號。
// Register
event_token HeadsetDisconnected(TypedEventHandler<IGameController, Headset const&> const& handler) const;
// Revoke with event_token
void HeadsetDisconnected(event_token const* cookie) const;
// Revoke with event_revoker
FlightStick::HeadsetDisconnected_revoker HeadsetDisconnected(auto_revoke_t, TypedEventHandler<IGameController, Headset const&> const& handler) const;
public event TypedEventHandler<IGameController,Headset> HeadsetDisconnected;
function onHeadsetDisconnected(eventArgs) { /* Your code */ }
flightStick.addEventListener("headsetdisconnected", onHeadsetDisconnected);
flightStick.removeEventListener("headsetdisconnected", onHeadsetDisconnected);
- or -
flightStick.onheadsetdisconnected = onHeadsetDisconnected;
Public Custom Event HeadsetDisconnected As TypedEventHandler(Of IGameController, Headset) Implements HeadsetDisconnected
事件類型
實作
範例
下列範例示範如何註冊此事件的處理常式。
#include <winrt/Windows.Gaming.Input.h>
using namespace winrt;
using namespace Windows::Gaming::Input;
...
FlightStick m_flightStick{ nullptr }; // Need to initialize this to a **FlightStick** that's connected to the device.
...
m_flightStick.HeadsetDisconnected([this](IGameController const& /* sender */, Headset const& /* args */)
{
// Disable headset capture and playback on this device.
});
// `flightStick` is a **FlightStick** that's connected to the device.
flightStick.HeadsetDisconnected += ref new TypedEventHandler<IGameController^, Headset^>(
[] (IGameController^ device, Headset^ headset)
{
// Disable headset capture and playback on this device.
});
備註
如需偵測、追蹤和使用頭戴式裝置的詳細資訊,請參閱 頭戴式裝置。