StrongReferenceMessenger Class

Definition

A class providing a reference implementation for the IMessenger interface.

public sealed class StrongReferenceMessenger : CommunityToolkit.Mvvm.Messaging.IMessenger
type StrongReferenceMessenger = class
    interface IMessenger
Public NotInheritable Class StrongReferenceMessenger
Implements IMessenger
Inheritance
StrongReferenceMessenger
Implements

Remarks

This IMessenger implementation uses strong references to track the registered recipients, so it is necessary to manually unregister them when they're no longer needed.

Constructors

StrongReferenceMessenger()

Properties

Default

Gets the default StrongReferenceMessenger instance.

Methods

IsRegistered<TMessage,TToken>(Object, TToken)

Checks whether or not a given recipient has already been registered for a message.

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

Registers a recipient for a given type of message.

Reset()

Resets the IMessenger instance and unregisters all the existing recipients.

Send<TMessage,TToken>(TMessage, TToken)

Sends a message of the specified type to all registered recipients.

Unregister<TMessage,TToken>(Object, TToken)

Unregisters a recipient from messages of a given type.

UnregisterAll(Object)

Unregisters a recipient from all registered messages.

UnregisterAll<TToken>(Object, TToken)

Unregisters a recipient from all messages on a specific channel.

Explicit Interface Implementations

IMessenger.Cleanup()

Extension Methods

IsRegistered<TMessage>(IMessenger, Object)

Checks whether or not a given recipient has already been registered for a 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.

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

Registers a recipient for a given type of message.

RegisterAll(IMessenger, Object)

Registers all declared message handlers for a given recipient, using the default channel.

RegisterAll<TToken>(IMessenger, Object, TToken)

Registers all declared message handlers for a given recipient.

Send<TMessage>(IMessenger, TMessage)

Sends a message of the specified type to all registered recipients.

Send<TMessage>(IMessenger)

Sends a message of the specified type to all registered recipients.

Send<TMessage,TToken>(IMessenger, TToken)

Sends a message of the specified type to all registered recipients.

Unregister<TMessage>(IMessenger, Object)

Unregisters a recipient from messages of a given type.

Applies to