The MessageHandler property gets an object that implements the IUnsolicitedMessages interface to handle unsolicited messages sent from the runtime system.
See IUnsolicitedMessages Interface for more information on the methods and properties supported by the MessageHandler property.
Namespace – ABSuite.AccessLayer.Connector.Core
Assembly – Unisys.ABSuite.AccessLayer.Connector.Core (in Unisys.ABSuite.AccessLayer.Connector.Core.dll)
Syntax
bool MessageHandler { get; }
Using the IConnection Interface for the MessageHandler Property
The following code is an example of using the MessageHandler property to register an event that notifies the application when an unsolicited message has arrived. The MessagesHandler object contains a MessageQueue where Unsolicited messages are queued for processing and the application is informed of a CollectionChanged event when a new message arrives. The QueueUpdate() method is then called to process the message. The CommandResponsesBuilder builds up a list of unsolicited messages in a string that can be displayed in the client application.
// Use a string builder to store responses from the host application CommandResponesBuilder = new StringBuilder(); // Register for the CollectionChanged event on the MessageQueue property // The QueueUpdate handler processes the responses when they are received. ABSConnection.MessagesHandler.MessageQueue.CollectionChanged += (o, e) => { this.QueueUpdate(e, ABSConnection.MessagesHandler.MessageQueue, this.CommandResponesBuilder); };