Radio.StateChanged Event
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Occurs when a radio's operational state changes.
// Register
event_token StateChanged(TypedEventHandler<Radio, IInspectable const&> const& handler) const;
// Revoke with event_token
void StateChanged(event_token const* cookie) const;
// Revoke with event_revoker
Radio::StateChanged_revoker StateChanged(auto_revoke_t, TypedEventHandler<Radio, IInspectable const&> const& handler) const;
public event TypedEventHandler<Radio,object> StateChanged;
function onStateChanged(eventArgs) { /* Your code */ }
radio.addEventListener("statechanged", onStateChanged);
radio.removeEventListener("statechanged", onStateChanged);
- or -
radio.onstatechanged = onStateChanged;
Public Custom Event StateChanged As TypedEventHandler(Of Radio, Object)
Event Type
TypedEventHandler<Radio,IInspectable>
Remarks
Overview
Raised for transitions between RadioState values. Lets apps adapt to user or system initiated changes (power policy, airplane mode, hardware switch, entitlement).
Recommended pattern
- Read current Radio.State inside the handler (do not rely on cached state).
- Apply minimal conditional logic (only act when the new state changes app behavior).
- Queue or dispatch heavier work outside the handler if needed.
- Unsubscribe (
-=) when the radio object is no longer required.