Edit

Share via


IMessengerExtensions.Register Method

Definition

Overloads

Register<TMessage,TToken>(IMessenger, IRecipient<TMessage>, TToken)

Registers a recipient for a given type of message.

Register<TMessage,TToken>(IMessenger, Object, TToken, MessageHandler<Object,TMessage>)

Registers a recipient for a given type of message.

Register<TMessage>(IMessenger, IRecipient<TMessage>)

Registers a recipient for a given type of message.

Register<TMessage>(IMessenger, Object, MessageHandler<Object,TMessage>)

Registers a recipient for a given type of message.

Register<TRecipient,TMessage>(IMessenger, TRecipient, MessageHandler<TRecipient,TMessage>)

Registers a recipient for a given type of message.

Register<TMessage,TToken>(IMessenger, IRecipient<TMessage>, TToken)

Registers a recipient for a given type of message.

public static void Register<TMessage,TToken> (this Microsoft.Toolkit.Mvvm.Messaging.IMessenger messenger, Microsoft.Toolkit.Mvvm.Messaging.IRecipient<TMessage> recipient, TToken token) where TMessage : class where TToken : IEquatable<TToken>;
static member Register : Microsoft.Toolkit.Mvvm.Messaging.IMessenger * Microsoft.Toolkit.Mvvm.Messaging.IRecipient<'Message (requires 'Message : null)> * 'oken -> unit (requires 'Message : null and 'oken :> IEquatable<'oken>)
<Extension()>
Public Sub Register(Of TMessage As Class, TToken As Class) (messenger As IMessenger, recipient As IRecipient(Of TMessage), token As TToken)

Type Parameters

TMessage

The type of message to receive.

TToken

The type of token to identify what channel to use to receive messages.

Parameters

messenger
IMessenger

The IMessenger instance to use to register the recipient.

recipient
IRecipient<TMessage>

The recipient that will receive the messages.

token
TToken

The token indicating what channel to use.

Exceptions

Thrown when trying to register the same message twice.

Remarks

This method will use the default channel to perform the requested registration.

Applies to

Register<TMessage,TToken>(IMessenger, Object, TToken, MessageHandler<Object,TMessage>)

Registers a recipient for a given type of message.

public static void Register<TMessage,TToken> (this Microsoft.Toolkit.Mvvm.Messaging.IMessenger messenger, object recipient, TToken token, Microsoft.Toolkit.Mvvm.Messaging.MessageHandler<object,TMessage> handler) where TMessage : class where TToken : IEquatable<TToken>;
static member Register : Microsoft.Toolkit.Mvvm.Messaging.IMessenger * obj * 'oken * Microsoft.Toolkit.Mvvm.Messaging.MessageHandler<obj, 'Message (requires 'Message : null)> -> unit (requires 'Message : null and 'oken :> IEquatable<'oken>)
<Extension()>
Public Sub Register(Of TMessage As Class, TToken As Class) (messenger As IMessenger, recipient As Object, token As TToken, handler As MessageHandler(Of Object, TMessage))

Type Parameters

TMessage

The type of message to receive.

TToken

The type of token to use to pick the messages to receive.

Parameters

messenger
IMessenger

The IMessenger instance to use to register the recipient.

recipient
Object

The recipient that will receive the messages.

token
TToken

A token used to determine the receiving channel to use.

handler
MessageHandler<Object,TMessage>

The MessageHandler<TRecipient,TMessage> to invoke when a message is received.

Exceptions

Thrown when trying to register the same message twice.

Applies to

Register<TMessage>(IMessenger, IRecipient<TMessage>)

Registers a recipient for a given type of message.

public static void Register<TMessage> (this Microsoft.Toolkit.Mvvm.Messaging.IMessenger messenger, Microsoft.Toolkit.Mvvm.Messaging.IRecipient<TMessage> recipient) where TMessage : class;
static member Register : Microsoft.Toolkit.Mvvm.Messaging.IMessenger * Microsoft.Toolkit.Mvvm.Messaging.IRecipient<'Message (requires 'Message : null)> -> unit (requires 'Message : null)
<Extension()>
Public Sub Register(Of TMessage As Class) (messenger As IMessenger, recipient As IRecipient(Of TMessage))

Type Parameters

TMessage

The type of message to receive.

Parameters

messenger
IMessenger

The IMessenger instance to use to register the recipient.

recipient
IRecipient<TMessage>

The recipient that will receive the messages.

Exceptions

Thrown when trying to register the same message twice.

Remarks

This method will use the default channel to perform the requested registration.

Applies to

Register<TMessage>(IMessenger, Object, MessageHandler<Object,TMessage>)

Registers a recipient for a given type of message.

public static void Register<TMessage> (this Microsoft.Toolkit.Mvvm.Messaging.IMessenger messenger, object recipient, Microsoft.Toolkit.Mvvm.Messaging.MessageHandler<object,TMessage> handler) where TMessage : class;
static member Register : Microsoft.Toolkit.Mvvm.Messaging.IMessenger * obj * Microsoft.Toolkit.Mvvm.Messaging.MessageHandler<obj, 'Message (requires 'Message : null)> -> unit (requires 'Message : null)
<Extension()>
Public Sub Register(Of TMessage As Class) (messenger As IMessenger, recipient As Object, handler As MessageHandler(Of Object, TMessage))

Type Parameters

TMessage

The type of message to receive.

Parameters

messenger
IMessenger

The IMessenger instance to use to register the recipient.

recipient
Object

The recipient that will receive the messages.

handler
MessageHandler<Object,TMessage>

The MessageHandler<TRecipient,TMessage> to invoke when a message is received.

Exceptions

Thrown when trying to register the same message twice.

Remarks

This method will use the default channel to perform the requested registration.

Applies to

Register<TRecipient,TMessage>(IMessenger, TRecipient, MessageHandler<TRecipient,TMessage>)

Registers a recipient for a given type of message.

public static void Register<TRecipient,TMessage> (this Microsoft.Toolkit.Mvvm.Messaging.IMessenger messenger, TRecipient recipient, Microsoft.Toolkit.Mvvm.Messaging.MessageHandler<TRecipient,TMessage> handler) where TRecipient : class where TMessage : class;
static member Register : Microsoft.Toolkit.Mvvm.Messaging.IMessenger * 'Recipient * Microsoft.Toolkit.Mvvm.Messaging.MessageHandler<'Recipient, 'Message (requires 'Recipient : null and 'Message : null)> -> unit (requires 'Recipient : null and 'Message : null)
<Extension()>
Public Sub Register(Of TRecipient As Class, TMessage As Class) (messenger As IMessenger, recipient As TRecipient, handler As MessageHandler(Of TRecipient, TMessage))

Type Parameters

TRecipient

The type of recipient for the message.

TMessage

The type of message to receive.

Parameters

messenger
IMessenger

The IMessenger instance to use to register the recipient.

recipient
TRecipient

The recipient that will receive the messages.

handler
MessageHandler<TRecipient,TMessage>

The MessageHandler<TRecipient,TMessage> to invoke when a message is received.

Exceptions

Thrown when trying to register the same message twice.

Remarks

This method will use the default channel to perform the requested registration.

Applies to