Udostępnij za pośrednictwem


ActivitySensor.ReadingChanged Event

Definition

Occurs each time the sensor reports a new sensor reading.

// Register
event_token ReadingChanged(TypedEventHandler<ActivitySensor, ActivitySensorReadingChangedEventArgs const&> const& handler) const;

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

// Revoke with event_revoker
ActivitySensor::ReadingChanged_revoker ReadingChanged(auto_revoke_t, TypedEventHandler<ActivitySensor, ActivitySensorReadingChangedEventArgs const&> const& handler) const;
public event TypedEventHandler<ActivitySensor,ActivitySensorReadingChangedEventArgs> ReadingChanged;
function onReadingChanged(eventArgs) { /* Your code */ }
activitySensor.addEventListener("readingchanged", onReadingChanged);
activitySensor.removeEventListener("readingchanged", onReadingChanged);
- or -
activitySensor.onreadingchanged = onReadingChanged;
Public Custom Event ReadingChanged As TypedEventHandler(Of ActivitySensor, ActivitySensorReadingChangedEventArgs) 

Event Type

Remarks

When you add a callback function, you receive an initial callback. However, there is a case where you will not receive this initial callback.

  • Add a callback function.
  • Remove the callback function.
  • Add another callback function (or the original one a second time)

In this sequence of events, the second callback function will not receive the initial callback. It will receive callback notifications normally when the ActivitySensor reports a new reading; only the initial callback will be missed.

Applies to