IUnsolicitedMessages Properties

The IUnsolicitedMessages interface exposes the properties listed in the following table:

Properties

Description

IUnsolicitedMessages.IsAcceptPending Property

Returns a value indicating whether there is an outstanding accept response pending for a running report.

IUnsolicitedMessages.IsCompleted Property

Returns a value indicating whether the currently active report is complete.

IUnsolicitedMessages.MessageQueue Property

Returns a string collection of messages from the runtime system as a response from a colon command.

IUnsolicitedMessages.ReportMessageQueue Property

Returns a string collection of messages from the runtime system as a response from a report initiation.

 

IUnsolicitedMessages.IsAcceptPending Property

The IsAcceptPending property returns a value indicating whether there is an outstanding accept response pending for a report that is running. It returns true if there is an outstanding accept response pending for a report that is running, otherwise it returns false.

Namespace – ABSuite.AccessLayer.Connector.Core

Assembly – Unisys.ABSuite.AccessLayer.Connector.Core (in Unisys.ABSuite.AccessLayer.Connector.Core.dll)

Syntax

bool IsAcceptPending { get; }

Using the IUnsolicitedMessages Interface for the IsAcceptPending Property

The following code is an example of using the IsAcceptPending property:

// An accept command must be prefixed with a greater than symbol ">"
string command == ">Continue";
// Check if an accept is pending and send the accept command
        if (this.Connection.MessagesHandler.IsAcceptPending)
        {
              this.Connection.MessagesHandler.SendAccept(command);  
        }

 

IUnsolicitedMessages.IsCompleted Property

The IsCompleted property returns a value indicating whether the currently active colon command is complete (this can be a standard command or a report initiation command). It returns true if the currently active colon command is complete; otherwise, it returns false.

Namespace – ABSuite.AccessLayer.Connector.Core

Assembly – Unisys.ABSuite.AccessLayer.Connector.Core (in Unisys.ABSuite.AccessLayer.Connector.Core.dll)

Syntax

bool IsCompleted { get; }

Using the IUnsolicitedMessages Interface for the IsCompleted Property

The following code is an example of using the IsCompleted property:

 // Check to see if the Colon command is complete
            if (ABSConnection.MessagesHandler.IsCompleted)
            {
                ABSConnection.Logger.LogInfo(() => string.Format("Command is complete!"));
            }

 

IUnsolicitedMessages.MessageQueue Property

The MessageQueue property returns an ObservableCollection of strings for the messages sent by the runtime system as a response to a colon command. You can register for the CollectionChanged event on an ObservableCollection that notifies the client when an update has been performed on the collection; that is, when a new message has been received from the host application.

Namespace – ABSuite.AccessLayer.Connector.Core

Assembly – Unisys.ABSuite.AccessLayer.Connector.Core (in Unisys.ABSuite.AccessLayer.Connector.Core.dll)

Syntax

IEnumerable<string> MessageQueue { get; }

Using the IUnsolicitedMessages Interface for the MessageQueue Property

The following code is an example of using the MessageQueue property for handling command responses:

// Declare a StringBuilder to hold the Command Responses
    CommandResponesBuilder = new StringBuilder();

    // Register for the CollectionChanged event for notification of 
   // new messages 

    ABSConnection.MessagesHandler.MessageQueue.CollectionChanged += (o, e) =>
    {
        this.QueueUpdate(e, ABSConnection.MessagesHandler.MessageQueue, this.CommandResponesBuilder);
    };
   // The QueueUpdate method handles changes in the 
  // ObeservableCollection of command and video report responses. 
 // When a message arrives, it is added to the 
// StringBuilder parameter. 
    // If the Collection is Reset, the StringBuilder parameter is 
   // cleared and new messages are added.
private void QueueUpdate(NotifyCollectionChangedEventArgs e, IList<string> items, StringBuilder builder)
    {
        switch (e.Action)
        {
            case NotifyCollectionChangedAction.Add:
                if (e.NewItems != null)
                {
                    foreach (string item in e.NewItems)
                    {
                        if (item.Trim() == ">")
                            builder.Append(item);
                        else
                            builder.AppendLine(item);
                    }                 
                }
                break;
            case NotifyCollectionChangedAction.Remove:
            case NotifyCollectionChangedAction.Replace:
                break;
 
            case NotifyCollectionChangedAction.Reset:
            {
                builder.Clear();
                foreach (string item in items)
                    builder.AppendLine(item);
            }
            break;
        }
    }

 

IUnsolicitedMessages.ReportMessageQueue Property

The ReportMessageQueue property returns a string collection of messages from the runtime system as a response from the initiation of a video report that directs its output to the client application.

You can register for the CollectionChanged event on an ObservableCollection that notifies the client when an update has been performed on the collection; that is, when a new message has been received from the host application.

Namespace – ABSuite.AccessLayer.Connector.Core

Assembly – Unisys.ABSuite.AccessLayer.Connector.Core (in Unisys.ABSuite.AccessLayer.Connector.Core.dll)

Syntax

IEnumerable<string> ReportMessageQueue { get; }

Using the IUnsolicitedMessages Interface for the ReportMessageQueue Property

The following code is an example of using the ReportMessageQueue property for handling video report responses:

// Declare a StringBuilder to hold the Report Responses
    ReportResponesBuilder = new StringBuilder();
 
    // Register for the CollectionChanged event for notification of 
    // new messages    
    ABSConnection.MessagesHandler.ReportMessageQueue.CollectionChanged += (o, e) =>
    {
        this.QueueUpdate(e, ABSConnection.MessagesHandler.ReportMessageQueue, this.ReportResponesBuilder);
    };
 
   // The QueueUpdate method handles changes in the 
   // ObeservableCollection of command and video report responses.    
  // When a message arrives, it is added to the StringBuilder parameter.
// If the Collection is Reset, the StringBuilder parameter is 
// cleared and new messages are added.        
    private void QueueUpdate(NotifyCollectionChangedEventArgs e, IList<string> items, StringBuilder builder)
    {
        switch (e.Action)
        {
            case NotifyCollectionChangedAction.Add:
                if (e.NewItems != null)
                {
                    foreach (string item in e.NewItems)
                    {
                        if (item.Trim() == ">")
                            builder.Append(item);
                        else
                            builder.AppendLine(item);
                    }                 
                }
                break;
 
            case NotifyCollectionChangedAction.Remove:
            case NotifyCollectionChangedAction.Replace:
                break;
 
            case NotifyCollectionChangedAction.Reset:
            {
                builder.Clear();
                foreach (string item in items)
                    builder.AppendLine(item);
            }
            break;
        }
    }