Class Handler
Handler gives you the ability to send and receive Message objects.
When you create a new Handler it is bound to a Looper. It will deliver messages to that Looper's message queue and execute them.
Inherited Members
Namespace: Unity.AppUI.Core
Assembly: Unity.AppUI.dll
Syntax
public class Handler
Constructors
Handler(Looper, Func<Message, bool>)
Declaration
public Handler(Looper looper, Func<Message, bool> callback)
Parameters
Type | Name | Description |
---|---|---|
Looper | looper | The looper. |
Func<Message, bool> | callback | The callback to handle received messages. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Some arguments are null. |
Methods
ObtainMessage(int, int, object)
Get a Message from the message pool.
Declaration
public Message ObtainMessage(int id, int arg1, object obj)
Parameters
Type | Name | Description |
---|---|---|
int | id | The message ID |
int | arg1 | An arbitrary integer value that will be passed with the message. |
object | obj | An arbitrary object that will be passed with the message. |
Returns
Type | Description |
---|---|
Message | A Message instance. |
ObtainMessage(int, object)
Get a Message from the message pool.
Declaration
public Message ObtainMessage(int id, object obj)
Parameters
Type | Name | Description |
---|---|---|
int | id | The message ID |
object | obj | An arbitrary object that will be passed with the message. |
Returns
Type | Description |
---|---|
Message | A Message instance. |
RemoveCallbacksAndMessages(object)
Remove any pending posts of callbacks and sent messages whose obj is token. If token is null, all callbacks and messages will be removed.
Declaration
public void RemoveCallbacksAndMessages(object token)
Parameters
Type | Name | Description |
---|---|---|
object | token | An object (it can be null). |
SendMessage(Message)
Send a message to the Looper message queue.
Declaration
public void SendMessage(Message msg)
Parameters
Type | Name | Description |
---|---|---|
Message | msg | The message to send. |
SendMessageDelayed(Message, int)
Send a message that will be enqueued into the Looper's message queue later.
Declaration
public void SendMessageDelayed(Message msg, int durationMs)
Parameters
Type | Name | Description |
---|---|---|
Message | msg | The message to send. |
int | durationMs | The enqueue delay, in milliseconds. |