Megosztás a következőn keresztül:


ISmsDevice.SmsMessageReceived Event

Definition

Sets an event handler to be called when the device receives a new text message.

public:
 event SmsMessageReceivedEventHandler ^ SmsMessageReceived;
/// [add: Windows.Foundation.Metadata.Deprecated("SmsDevice may be altered or unavailable for releases after Windows 10. Instead, use SmsDevice2.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, Windows.Devices.Sms.LegacySmsApiContract)]
/// [remove: Windows.Foundation.Metadata.Deprecated("SmsDevice may be altered or unavailable for releases after Windows 10. Instead, use SmsDevice2.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, Windows.Devices.Sms.LegacySmsApiContract)]
// Register
event_token SmsMessageReceived(SmsMessageReceivedEventHandler const& handler) const;

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

// Revoke with event_revoker
ISmsDevice::SmsMessageReceived_revoker SmsMessageReceived(auto_revoke_t, SmsMessageReceivedEventHandler const& handler) const;
/// [add: Windows.Foundation.Metadata.Deprecated("SmsDevice may be altered or unavailable for releases after Windows 10. Instead, use SmsDevice2.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.Devices.Sms.LegacySmsApiContract")]
/// [remove: Windows.Foundation.Metadata.Deprecated("SmsDevice may be altered or unavailable for releases after Windows 10. Instead, use SmsDevice2.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.Devices.Sms.LegacySmsApiContract")]
// Register
event_token SmsMessageReceived(SmsMessageReceivedEventHandler const& handler) const;

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

// Revoke with event_revoker
ISmsDevice::SmsMessageReceived_revoker SmsMessageReceived(auto_revoke_t, SmsMessageReceivedEventHandler const& handler) const;
[add: Windows.Foundation.Metadata.Deprecated("SmsDevice may be altered or unavailable for releases after Windows 10. Instead, use SmsDevice2.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, typeof(Windows.Devices.Sms.LegacySmsApiContract))]
[remove: Windows.Foundation.Metadata.Deprecated("SmsDevice may be altered or unavailable for releases after Windows 10. Instead, use SmsDevice2.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, typeof(Windows.Devices.Sms.LegacySmsApiContract))]
event SmsMessageReceivedEventHandler SmsMessageReceived;
[add: Windows.Foundation.Metadata.Deprecated("SmsDevice may be altered or unavailable for releases after Windows 10. Instead, use SmsDevice2.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.Devices.Sms.LegacySmsApiContract")]
[remove: Windows.Foundation.Metadata.Deprecated("SmsDevice may be altered or unavailable for releases after Windows 10. Instead, use SmsDevice2.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.Devices.Sms.LegacySmsApiContract")]
event SmsMessageReceivedEventHandler SmsMessageReceived;
function onSmsMessageReceived(eventArgs) { /* Your code */ }
iSmsDevice.addEventListener("smsmessagereceived", onSmsMessageReceived);
iSmsDevice.removeEventListener("smsmessagereceived", onSmsMessageReceived);
- or -
iSmsDevice.onsmsmessagereceived = onSmsMessageReceived;
Event SmsMessageReceived As SmsMessageReceivedEventHandler 

Event Type

Attributes

Windows requirements

App capabilities
cellularMessaging sms

Applies to