Bagikan melalui


FlightStick.FlightStickAdded Kejadian

Definisi

Sinyal ketika tongkat penerbangan baru terhubung.

// Register
static event_token FlightStickAdded(EventHandler<FlightStick> const& handler) const;

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

// Revoke with event_revoker
static FlightStick::FlightStickAdded_revoker FlightStickAdded(auto_revoke_t, EventHandler<FlightStick> const& handler) const;
public static event System.EventHandler<FlightStick> FlightStickAdded;
function onFlightStickAdded(eventArgs) { /* Your code */ }
Windows.Gaming.Input.FlightStick.addEventListener("flightstickadded", onFlightStickAdded);
Windows.Gaming.Input.FlightStick.removeEventListener("flightstickadded", onFlightStickAdded);
- or -
Windows.Gaming.Input.FlightStick.onflightstickadded = onFlightStickAdded;
Public Shared Custom Event FlightStickAdded As EventHandler(Of FlightStick) 

Jenis Acara

Contoh

Contoh berikut mulai melacak tongkat penerbangan yang telah ditambahkan.

#include <winrt/Windows.Gaming.Input.h>
using namespace winrt;
using namespace Windows::Gaming::Input;
...
std::vector<FlightStick> m_myFlightSticks;
...
FlightStick::FlightStickAdded([this](IInspectable const& /* sender */, FlightStick const& args)
    {
        m_myFlightSticks.push_back(args);
    });
FlightStick::FlightStickAdded += 
    ref new EventHandler<FlightStick^>([] (Platform::Object^, FlightStick^ args)
{
    // This code assumes that you're interested in all new flight sticks.
    // `myFlightSticks` is a `Vector<FlightStick^>` that contains the flight sticks that your game is tracking.
    myFlightSticks->Append(args);
});

Keterangan

Untuk mengidentifikasi tongkat penerbangan yang telah ditambahkan, Anda meminta daftar tongkat penerbangan yang terhubung menggunakan FlightStick.FlightSticks. Namun, karena Anda mungkin hanya tertarik pada beberapa tongkat penerbangan yang terhubung, kami sarankan Anda mempertahankan koleksi Anda sendiri alih-alih mengaksesnya melalui FlightSticks.

Berlaku untuk