IConnection Events

The IConnection Interface exposes the events listed in the following table:

Events

Description

IConnection.ChangeLocaleRequest Event

Gets triggered when a language change occurs in the runtime system.

IConnection.ChangeSystemCompleted Event

Gets triggered when you have switched to another system (Switch to).

IConnection.ChangeSystemRequest Event

Gets triggered when the runtime system performs a Switch to another system.

IConnection.CloseRequest Event

Gets triggered when the runtime system closes a session with the client.

IConnection.ConnectionProgressStatus Event

Gets triggered when the state of the connection progress changes.

IConnection.DownLoadComplete Event

Gets triggered when the required assemblies for a client session is downloaded successfully.

IConnection.DuplicateLoginRequest Event

Gets triggered when the runtime system detects that the user requesting a session is already logged into the system.

IConnection.IsBusyChanged Event

Gets triggered when a change occurs in the Busy state for a connection.

IConnection.ProcessTransactionErrors Event

Gets triggered when the runtime system returns error messages to a client session.

IConnection.SetCursorRequest Event

Gets triggered when the runtime system sets the focus on a field in the current DataModel.

IConnection.ShowTeachRequest Event

Gets triggered when the runtime system requests the view to display a teach class.

IConnection.StatusChanged Event

Gets triggered when the status information is updated by the runtime system.

IConnection.TransmissionObjectChanged Event

Gets triggered when the response from the runtime system requires a different DataModel to be used, instead of the current DataModel.

Each event typically includes a related EventArgs object containing event arguments to provide information about the event. The following topics list the possible event argument types and their descriptions.

 

ConnectionEventArgs

The ConnectionEventArgs class is used to convey information to a caller registered to receive one of the following events:

An instance of this class is returned to the EventHandler with the relevant information.

The ConnectionEventArgs class contains the following properties:

Properties

Description

TransmissionObject TransObject

The current TransmissionObject held by the Connector.

string FocusField

The field in the DataModel that has been given the focus by the runtime system.

int ColumnIndex

The Copy Index when the FocusField is part of a CopyFrom region. This specifies the index of the list item in the collection returned for a Copy.From set.

 

InformationEventArgs

The InformationEventArgs class is used to convey information to a caller registered to receive the ConnectionProgressStatus event.

An instance of this class is returned to the EventHandler with the relevant information.

The InformationEventArgs class contains the following properties:

Properties

Description

InformationType Information

This property contains information about the ConnectionEventArgs event. It is an instance of the InformationType enumeration that can contain one of the following values:

0 – Connected. The client session is connected to the host system.

1 – Connecting. The client session is in the process of connecting to the host system.

2 – ConnectionFailed. The client session failed to connect to the host system.

3 – InputValidationError. The data sent from the client is invalid according to the DataModel definition.

string [] Info

A collection of string containing the host or system name.

 

ConnectionCloseRequestArgs

The ConnectionCloseRequestArgs class is used to convey information to a caller registered to receive the CloseRequest event.

An instance of this class is returned to the EventHandler with the relevant information.

The ConnectionCloseRequestArgs class contains the following property:

Properties

Description

bool ForcedClosure

This property is set to true when the host system has closed the connection.

 

ShowClassRecallScreenEventArgs

The ShowClassRecallScreenEventArgs class is used to convey information to a caller registered to receive the ShowTeachRequest event.

An instance of this class is returned to the EventHandler with the relevant information.

The ShowClassRecallScreenEventArgs class contains the following properties:

Properties

Description

string Owner

The ispec or class name that owns the Teach screen.

string Name

The name of the Teach screen.

 

ConnectionDownloadCompleteEventArgs

The ConnectionDownLoadCompleteEventArgs class is used to convey information to a caller registered to receive the DownLoadComplete event.

An instance of this class is returned to the EventHandler with the relevant information.

The ConnectionDownloadCompleteEventArgs class contains the following property:

Properties

Description

string Path

The location of the downloaded files.

 

ConnectionChangeSystemRequestCancelEventArgs

The ConnectionChangeSystemRequestCancelEventArgs class is used to convey information to a caller registered to receive the ChangeSystemRequest event.

An instance of this class is returned to the EventHandler with the relevant information.

The ConnectionChangeSystemRequestCancelEventArgs class contains the following properties:

Properties

Description

string Name

The name of the system being switched to.

string Host

The domain name or IP address of the machine where the host system is running.

string StationName

The station name to be used while connecting to the system.

string DownloadURI

The location from where the required assemblies can be downloaded.

IEnumerable<string> DownloadFiles

A comma separated list of assemblies that has to be downloaded.

bool IsAnonymous

Specifies whether the connection to the host system uses anonymous access.

bool ForceLogin

Specifies whether the connection overrides any previous login for a specified user.

bool ConnectToDebugger

Specifies whether the system being switched to is connecting to a Debugger session.

 

TransactionErrorsArgs

The TransactionErrorsArgs class is used to convey information to a caller registered to receive the ProcessTransactionErrors event.

An instance of this class is returned to the EventHandler with the relevant information.

The TransactionErrorsArgs class contains the following properties:

Properties

Description

bool ShowDialog

Specifies whether an Error dialog box should appear. This is set to True when multiple errors are returned.

IEnumerable<string> Errors

A list of errors returned from the runtime system.

IConnection.ChangeLocaleRequest Event

The ChangeLocaleRequest event is triggered when a language change occurs in the runtime system.

Namespace – ABSuite.AccessLayer.Connector.Core

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

Syntax

event EventHandler<ConnectionEventArgs> ChangeLocaleRequest

Using the IConnection Interface for the ChangeLocaleRequest Event

The following code is an example of using the ChangeLocaleRequest Event:

// Register for the Locale Change event, update the client language 
// to load up resources for the new language
this.Connection.ChangeLocaleRequest += (o, ee) =>
{
if (ee.Locale > 0)
       {
         this.Language = this.Languages.FirstOrDefault(l => l.Culture.LCID == ee.Locale);
       };
};

IConnection.ChangeSystemCompleted Event

The ChangeSystemCompleted event is triggered when you have switched to another system (Switch to).

Namespace – ABSuite.AccessLayer.Connector.Core

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

Syntax

event EventHandler<ConnectionDownLoadCompleteEventArgs> 
ChangeSystemCompleted

IConnection.ChangeSystemRequest Event

The ChangeSystemRequest event is triggered when the runtime system performs a switch to another system.

Namespace – ABSuite.AccessLayer.Connector.Core

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

Syntax

event EventHandler<ConnectionChangeSystemRequestCancelEventArgs> 
ChangeSystemRequest

Using the IConnection Interface for the ChangeSystemRequest Event

The following code is an example of using the ChangeSystemRequest event:

// HandleChangeSystemRequest is the handler for processing the 
// ChangeSystemRequest event when the Host application does a switch 
// to another application.  
    public void HandleChangeSystemRequest(object sender, ConnectionChangeSystemRequestCancelEventArgs args)
    {
      // A switch to another application has occurred. Retrieve the 
      // new system name and log it. 
      // The client application must have a reference to the 
      // DataModels assembly for the system being switched. 
      // Otherwise it will not be able to process the 
      // transactions for the new application context. 
            
        string newSystem = args.Name;
        ApplicationLogger.LogInfo(() => string.Format("Host Application has switched to system: {0}", 
        newSystem));
}

IConnection.CloseRequest Event

The CloseRequest event is triggered when the runtime system closes the session with the client.

Namespace – ABSuite.AccessLayer.Connector.Core

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

Syntax

event EventHandler<ConnectionCloseRequestArgs> CloseRequest

Using the IConnection Interface for the CloseRequest Event

The following code is an example of using the CloseRequest event:

// HandleHostSessionClosed is the handler for processing the 
// CloseRequest event triggered when a BYE request is sent from the 
// Host application. It checks the ConnectionClosedRequestArgs 
// object for more information about the event.
     public void HandleHostSessionClosed(object sender, ConnectionClosedRequestArgs args)
     {
   // Log a message and clean up the session
        if (args.ForcedClosure)
            ApplicationLogger.LogInfo(() => string.Format("Host system has closed the session!"));
        else
            ApplicationLogger.LogInfo(() => string.Format("Session closed unexpectedly!"));

Session.Abandon();
     }     // Register for CloseRequest event. When the event is triggered, the 
           // specified method is called to handle the event.
     ABSConnection.CloseRequest += HandleHostSessionClosed;

IConnection.ConnectionProgressStatus Event

The ConnectionProgressStatus event is triggered when the state of the connection progress changes.

Namespace – ABSuite.AccessLayer.Connector.Core

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

Syntax

event EventHandler<InformationEventArgs> ConnectionProgressStatus

Using the IConnection Interface for the ConnectionProgressStatus Event

The following code is an example of using the CloseRequest event:

// Register for the ConnectionProgressStatus event
ABSConnection.ConnectionProgressStatus += HandleConnectionProgress;

// HandleConnectionProgress is the handler for processing the 
// ConnectionProgressStatus event that is triggered when the state 
// of the Connection processing changes.  
        public void HandleConnectionProgress(object sender, InformationEventArgs args)
        {
          // Check the connection information and log a message
          InformationEventArgs.InformationType iType = (InformationEventArgs.InformationType)args.Information;

          if (iType == InformationEventArgs.InformationType.Connected)
              ApplicationLogger.LogInfo(() => string.Format("Client connected successfully 
              to the Host system!"));
           
          if (iType == InformationEventArgs.InformationType.Connecting)
              ApplicationLogger.LogInfo(() => string.Format("Client is connecting to the Host system."));

          if (iType == InformationEventArgs.InformationType.ConnectionFailed)
              ApplicationLogger.LogInfo(() => string.Format("Client could not connect to the Host system!"));
     If (args.Info != null)
              ApplicationLogger.LogInfo(() => string.Format("Connection progress information: {0}",args.Info));
      
        }

IConnection.DownLoadComplete Event

The DownLoadComplete event is triggered when the required assemblies for the client session have been downloaded successfully.

Namespace – ABSuite.AccessLayer.Connector.Core

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

Syntax

event EventHandler<ConnectionDownLoadCompleteEventArgs> 
DownLoadComplete

Using the IConnection Interface for the DownLoadComplete Event

The following code is an example of using the DownLoadComplete event:

// Register for the DownLoadComplete event
ABSConnection.DownLoadComplete += HandleDownloadComplete;

// HandleDownloadComplete is the handler for processing the 
// DownLoadComplete event 
// when the required assemblies have been downloaded from the 
// specified Assembly Location 
    public void HandleDownloadComplete(object sender, ConnectionDownLoadCompleteEventArgs args)
    {
        // Log the path to the downloaded files
        string DownloadFilePath = args.Path;
        ApplicationLogger.LogInfo(() => string.Format("Assemblies have been downloaded to: {0}",
        DownloadFilePath));

    }

IConnection.DuplicateLoginRequest Event

The DuplicateLoginRequest event is triggered when the runtime system detects that the user requesting a session has already logged into the system.

Namespace – ABSuite.AccessLayer.Connector.Core

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

Syntax

event EventHandler<CancelEventArgs> DuplicateLoginRequest

Using the IConnection Interface for the DuplicateLoginRequest Event

The following code is an example of using the DuplicateLoginRequest event:

// Register for the DuplicateLoginRequest event
 ABSConnection.DuplicateLoginRequest += HandleDuplicateLogin;

// HandleDuplicateLogin is the handler for processing the 
// DuplicateLoginRequest event when a new session tries to connect 
// to the host system using Login credentials that are already being 
// used by an existing session. 
        public void HandleDuplicateLogin(object sender, CancelEventArgs args)
        {
            // Cancel the event and Log a message 
            args.Cancel = true;
            ApplicationLogger.LogInfo(() => string.Format("A duplicate Login condition has been encountered!"));

        }

IConnection.IsBusyChanged Event

The IsBusyChanged event is triggered when a change occurs in the busy state of the connection.

Namespace – ABSuite.AccessLayer.Connector.Core

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

Syntax

event EventHandler IsBusyChanged

Using the IConnection Interface for the IsBusyChanged Event

The following code is an example of using the IsBusyChanged event:

// Register for the event
ABSConnection.IsBusyChanged += HandleIsBusyChanged;

// HandleIsbusyChanged is the handler for processing the 
// IsBusyChanged event when a change occurs in the Busy state 
// of the connection. 
    public void HandleIsBusyChanged ()
    {
    // Retrieve the current Busy state of the connection and log it.
        if (ABSConnection.IsBusy)
            ApplicationLogger.LogInfo(() => string.Format("Connection is currently busy 
            processing a request!"));

    }

IConnection.ProcessTransactionErrors Event

The ProcessTransactionErrors event is triggered when the runtime system returns error messages to a client session.

Namespace – ABSuite.AccessLayer.Connector.Core

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

Syntax

event EventHandler<TransactionErrorsArgs> ProcessTransactionErrors

Using the IConnection Interface for the ProcessTransactionErrors Event

The following code is an example of using the ProcessTransactionErrors event:

// Register for the ProcessTransactionErrors event   
ABSConnection.ProcessTransactionErrors += HandleTransactionErrors; 

// HandleTransactionErrors is the handler for processing the error 
// messages received from the host as a result of the transaction 
// request.  
        public void HandleTransactionErrors(object sender, TransactionErrorsArgs args)
        {
            // Retrieve the event details and log the information
            ApplicationLogger.LogInfo(() => string.Format("Transaction request resulted in 
            errors from the host application"));

            // Check the HasErrors property
            if (args.HasErrors)
            {
                ApplicationLogger.LogInfo(() => string.Format("TransactionErrors ShowDialog is true!"));
// Call the ProcessErrors method to process the errors from the host 
// system 
                ProcessErrors(args.Errors);

            }

            // Call the ProcessErros method to process the errors 
            // from the host system 
            ProcessErrors(args.Errors);
}

IConnection.SetCursorRequest Event

The SetCursorRequest event is triggered when the runtime system sets the focus on a field in the current DataModel.

Namespace – ABSuite.AccessLayer.Connector.Core

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

Syntax

event EventHandler<ConnectionEventArgs> SetCursorRequest

Using the IConnection Interface for the SetCursorRequest Event

The following code is an example of using the SetCursorRequest event:

// Register for the SetCursorRequest event 
 ABSConnection.SetCursorRequest += HandleCursorRequest;

// HandleCursorRequest is the handler for processing the 
// SetCursorRequest event when the Host application sets the cursor 
// to a specific field in the DataModel.  
     public void HandleCursorRequest(object sender, ConnectionEventArgs args)
     {
      // Retrieve the cursor information 
      string cursorField = args.FocusField;   // Field name to set the focus
         int cursorCopy = args.ColumnIndex;   // Copy row number if it is a Copy.From ispec

         ApplicationLogger.LogInfo(() => string.Format("Cursor Field is set to: {0}. ColumnIndex is {1}",
         cursorField, cursorCopy));

}

IConnection.ShowTeachRequest Event

The ShowTeachRequest event is triggered when the runtime system requests the view to display a teach class.

Namespace – ABSuite.AccessLayer.Connector.Core

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

Syntax

event EventHandler<ShowClassRecallScreenEventArgs> 
ShowTeachRequest

 

Using the IConnection Interface for the ShowTeachRequest Event

The following code is an example of using the ShowTeachRequest event:

// Register for the event  
ABSConnection.ShowTeachRequest += HandleTeachRequest;

// HandleTeachRequest is the handler for processing the 
// ShowTeachRequest event when the Host application sets the cursor 
// to a specific field in the DataModel.  
    public void HandleTeachRequest(object sender, ShowClassRecallScreenEventArgs args)
    {
        // Retrieve the Teach screen information  
        string teachScreen = args.Name;   // Name of the Teach 
        string ownerIspec = args.Owner;  // Ispec or class that owns 
      // the Teach screen

        ApplicationLogger.LogInfo(() => string.Format("Display Teach screen: {0}  for ispec {1}", 
        teachScreen, ownerIspec));

    }

IConnection.StatusChanged Event

The StatusChanged event is triggered when the status information is updated by the runtime system.

Namespace – ABSuite.AccessLayer.Connector.Core

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

Syntax

event EventHandler StatusChanged

Using the IConnection Interface for the StatusChanged Event

The following code is an example of using the StatusChanged event:

// Register for the StatusChanged event
ABSConnection.StatusChanged += HandleStatusChanged;

// HandleStatusChanged is the handler for processing the 
// StatusChanged event when the status information sent by the Host 
// application changes.  
   public void HandleStatusChanged(object sender, EventArgs args)
   {
    // The status information has changed. Check the Status property 
       string statusInfo = ABSConnection.Status;
       ApplicationLogger.LogInfo(() => string.Format("Current Status info: {0}", statusInfo));

   }

IConnection.TransmissionObjectChanged Event

The TransmissionObjectChanged event is triggered when the response from the runtime system requires a different DataModel to be used, instead of the current DataModel.

Namespace – ABSuite.AccessLayer.Connector.Core

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

Syntax

event EventHandler<ConnectionEventArgs> 
TransmissionObjectChanged

Using the IConnection Interface for the TransmissionObjectChanged Event

The following code is an example of using the TransmissionObjectChanged event:

// HandleTransmissionObjectChanged is the handler for processing the 
// TransmissionObjectChanged event when the Host application context 
// changes to a different ispec.  
   public void HandleTransmissionObjecChanged(object sender, ConnectionEventArgs args)
   {
    // The status information has changed. Check the Status property 
       string newIspecName = args.TransObject.ObjectClassName; 
       ApplicationLogger.LogInfo(() => string.Format("Context has been changed to ispec: {0}", newIspecName));

   }