Bagikan melalui


FlightStick.HeadsetConnected Kejadian

Definisi

Memberi sinyal ketika headset terpasang pada tongkat penerbangan.

// Register
event_token HeadsetConnected(TypedEventHandler<IGameController, Headset const&> const& handler) const;

// Revoke with event_token
void HeadsetConnected(event_token const* cookie) const;

// Revoke with event_revoker
FlightStick::HeadsetConnected_revoker HeadsetConnected(auto_revoke_t, TypedEventHandler<IGameController, Headset const&> const& handler) const;
public event TypedEventHandler<IGameController,Headset> HeadsetConnected;
function onHeadsetConnected(eventArgs) { /* Your code */ }
flightStick.addEventListener("headsetconnected", onHeadsetConnected);
flightStick.removeEventListener("headsetconnected", onHeadsetConnected);
- or -
flightStick.onheadsetconnected = onHeadsetConnected;
Public Custom Event HeadsetConnected As TypedEventHandler(Of IGameController, Headset) Implements HeadsetConnected

Jenis Acara

Penerapan

Contoh

Contoh berikut menunjukkan cara mendaftarkan handler untuk kejadian ini.

#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.HeadsetConnected([this](IGameController const& /* sender */, Headset const& /* args */)
    {
        // Enable headset capture and playback on this device.
    });
`flightStick` is a **FlightStick** that's connected to the device.
flightStick.HeadsetConnected += ref new TypedEventHandler<IGameController^, Headset^>(
    [] (IGameController^ device, Headset^ headset)
{
    // Enable headset capture and playback on this device.
});

Keterangan

Untuk informasi selengkapnya tentang mendeteksi, melacak, dan menggunakan headset, lihat Headset.

Berlaku untuk

Lihat juga