gOPCUAConnector.gAsyncWriteOneItemCompleted Event

Top  Previous  Next

Description

Occurs when gAsyncWriteOneItem method is completed.

 

VB syntax

Private Sub gOPCUAConnector_gAsyncWriteOneItemCompleted(sender As Object, transactionID As String, operationResult As gOPCUAStatusCode, resultObject As gOPCUAReadWriteObjectHandles gOPCUAConnector.gAsyncWriteOneItemCompleted

 

C# syntax

private void gOPCUAConnector_gAsyncWriteOneItemCompleted(object sender, string transactionID, gOPCUAStatusCode operationResult, gOPCUAReadWriteObject resultObject)

 

Arguments

sender

OPC UA Connector that raising this event.

 

transactionID

ID of asynchronous operation that caused this event.

 

operationResult

Gives information about result of gAsyncWriteOneItem method.

 

resultObjects

Object that holds information of OPC Node that you wanted to write to.

 

C# code example

 

    //This event is the response to gAsyncWriteOneItem method.

        private void gOPCUAConnector1_gAsyncWriteOneItemCompleted(object sender, string transactionID, GelecekCommon.gOPCUAStatusCode operationResult, GelecekCommon.gOPCUAReadWriteObject resultObject)

        {

            try

            {

                //Check transaction

                if (transactionID == txtTransactionID.Text)

                {

                    //Check operation result and status code, 

                    txtOperationResult.Text = operationResult.ToString();

                    txtStatusCode1.Text = resultObject.StatusCode.ToString();

 

                    //For a successfull write, operation result sould be "Good", status code should be "Good" 

                    if (operationResult != GelecekCommon.gOPCUAStatusCode.Good || resultObject.StatusCode != GelecekCommon.gOPCUAStatusCode.Good)

                    {

                        MessageBox.Show("OPC UA Connector Tutorial Project: Error in asynchronous writing");

 

                    }

 

                }

            }

            catch (Exception ex)

            {

                MessageBox.Show(ex.Message);

            }

        }