RawGameController.RawGameControllerRemoved Kejadian
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Sinyal ketika pengontrol permainan mentah terputus.
// Register
static event_token RawGameControllerRemoved(EventHandler<RawGameController> const& handler) const;
// Revoke with event_token
static void RawGameControllerRemoved(event_token const* cookie) const;
// Revoke with event_revoker
static RawGameController::RawGameControllerRemoved_revoker RawGameControllerRemoved(auto_revoke_t, EventHandler<RawGameController> const& handler) const;
public static event System.EventHandler<RawGameController> RawGameControllerRemoved;
function onRawGameControllerRemoved(eventArgs) { /* Your code */ }
Windows.Gaming.Input.RawGameController.addEventListener("rawgamecontrollerremoved", onRawGameControllerRemoved);
Windows.Gaming.Input.RawGameController.removeEventListener("rawgamecontrollerremoved", onRawGameControllerRemoved);
- or -
Windows.Gaming.Input.RawGameController.onrawgamecontrollerremoved = onRawGameControllerRemoved;
Public Shared Custom Event RawGameControllerRemoved As EventHandler(Of RawGameController)
Jenis Acara
Keterangan
Contoh berikut berhenti melacak pengontrol game mentah yang telah dihapus.
#include <algorithm>
#include <winrt/Windows.Gaming.Input.h>
using namespace winrt;
using namespace Windows::Gaming::Input;
...
std::vector<RawGameController> m_myRawGameControllers;
...
RawGameController::RawGameControllerRemoved([this](IInspectable const& /* sender */, RawGameController const& args)
{
std::remove(m_myRawGameControllers.begin(), m_myRawGameControllers.end(), args);
});
// `myRawGameControllers` is a `Vector<RawGameController^>` that contains the raw game controllers that your game is tracking.
RawGameController::RawGameControllerRemoved +=
ref new EventHandler<RawGameController^>(
[] (Platform::Object^, RawGameController^ args)
{
unsigned int indexRemoved;
if (myRawGameControllers->IndexOf(args, &indexRemoved))
{
myRawGameControllers->RemoveAt(indexRemoved);
}
});