< All Topics
Internal communication
PostedNovember 5, 2021
UpdatedNovember 5, 2021
ByKasper Vestrup
Experior provides an infrastructure for sending messages between objects.
In the Developer samples catalog an example of how to do this can be found.
The basic steps are;
- Register an object as a listener.
Core.Communication.Internal.AddListener(object listener, RecieveMessage method)
For example.
Core.Communication.Internal.AddListener(this, ReceiveMethod);
Where a method like this should be provided.
void ReceiveMethod(object sender, object reciever, object message, bool broadcast)
2. Send a message to a known receiver.
Core.Communication.Internal.SendMessage(object sender, object reciever, object message)
Broadcast a message to all listeners.
Core.Communication.Internal.BroadcastMessage(object sender, object message)
Broadcast a message to all listeners of a specific type.
Core.Communication.Internal.BroadcastMessage(object sender, Type recieverType, object message)
Broadcast a message to all listeners of a specific type (FullName).
Core.Communication.Internal.BroadcastMessage(object sender, string recieverTypeFullName, object message)
3. When an object should stop listen or is disposed it should be removed.
Core.Communication.Internal.RemoveListener(object listener)
Note: The specified delegate of the reciever is executed synchronously.