다음을 통해 공유


MessagingCenter.IMessagingCenter.Subscribe Method

Definition

Overloads

IMessagingCenter.Subscribe<TSender,TArgs>(Object, String, Action<TSender,TArgs>, TSender)

Subscribes to the specified message from the specified source.

IMessagingCenter.Subscribe<TSender>(Object, String, Action<TSender>, TSender)

Subscribes to the specified message from the specified source.

IMessagingCenter.Subscribe<TSender,TArgs>(Object, String, Action<TSender,TArgs>, TSender)

Subscribes to the specified message from the specified source.

void IMessagingCenter.Subscribe<TSender,TArgs> (object subscriber, string message, Action<TSender,TArgs> callback, TSender source) where TSender : class;
abstract member Xamarin.Forms.IMessagingCenter.Subscribe : obj * string * Action<'Sender, 'Args (requires 'Sender : null)> * 'Sender -> unit (requires 'Sender : null)
override this.Xamarin.Forms.IMessagingCenter.Subscribe : obj * string * Action<'Sender, 'Args (requires 'Sender : null)> * 'Sender -> unit (requires 'Sender : null)

Type Parameters

TSender

The type of object that sends the message.

TArgs

The type of the objects that are used as message arguments for the message.

Parameters

subscriber
System.Object

The object that is subscribing to the messages. Typically, this is specified with the this keyword used within the subscribing object.

message
System.String

The message that will be sent to objects that are listening for the message from instances of type TSender.

callback
System.Action<TSender,TArgs>

A callback, which takes the sender and arguments as parameters, that is run when the message is received by the subscriber.

source
TSender

The object that will send the messages.

Implements

Applies to

IMessagingCenter.Subscribe<TSender>(Object, String, Action<TSender>, TSender)

Subscribes to the specified message from the specified source.

void IMessagingCenter.Subscribe<TSender> (object subscriber, string message, Action<TSender> callback, TSender source) where TSender : class;
abstract member Xamarin.Forms.IMessagingCenter.Subscribe : obj * string * Action<'Sender (requires 'Sender : null)> * 'Sender -> unit (requires 'Sender : null)
override this.Xamarin.Forms.IMessagingCenter.Subscribe : obj * string * Action<'Sender (requires 'Sender : null)> * 'Sender -> unit (requires 'Sender : null)

Type Parameters

TSender

The type of object that sends the message.

Parameters

subscriber
System.Object

The object that is subscribing to the messages. Typically, this is specified with the this keyword used within the subscribing object.

message
System.String

The message to subscribe to from source.

callback
System.Action<TSender>

A callback, which takes the sender and arguments as parameters, that is run when the message is received by the subscriber.

source
TSender

The object that will send the messages.

Implements

Applies to