QuickOPC User's Guide and Reference
ChangeMultipleItemSubscriptions Method (IEasyDAClient)
Example 



OpcLabs.EasyOpcClassic Assembly > OpcLabs.EasyOpc.DataAccess Namespace > IEasyDAClient Interface : ChangeMultipleItemSubscriptions Method
Array of arguments, one element per each OPC item involved in the operation.
Changes parameters of subscriptions to multiple OPC items.
Syntax
'Declaration
 
Sub ChangeMultipleItemSubscriptions( _
   ByVal argumentsArray() As DAHandleGroupArguments _
) 
'Usage
 
Dim instance As IEasyDAClient
Dim argumentsArray() As DAHandleGroupArguments
 
instance.ChangeMultipleItemSubscriptions(argumentsArray)
void ChangeMultipleItemSubscriptions( 
   DAHandleGroupArguments[] argumentsArray
)
void ChangeMultipleItemSubscriptions( 
   array<DAHandleGroupArguments^>^ argumentsArray
) 

Parameters

argumentsArray
Array of arguments, one element per each OPC item involved in the operation.
Exceptions
ExceptionDescription
A null reference (Nothing in Visual Basic) is passed to a method that does not accept it as a valid argument.
One of the arguments provided to a method is not valid.
Remarks

The user-defined state, as given in OpcLabs.BaseLib.OperationModel.OperationArguments.State property of OpcLabs.EasyOpc.DataAccess.OperationModel.EasyDAItemSubscriptionArguments when subscribing to the item, cannot be changed. The OpcLabs.BaseLib.OperationModel.OperationArguments.State property of OpcLabs.EasyOpc.DataAccess.OperationModel.DAHandleGroupArguments in the ChangeMultipleItemSubscriptions method call is not used.

When you use this method, the OpcLabs.EasyOpc.DataAccess.OperationModel.EasyDAItemChangedEventArgs.Arguments in the event notifications and callbacks may, during the transition period, correspond to an improper (older or newer) value.

 

This method operates (at least in part) asynchronously, with respect to the caller. The actual execution of the operation may be delayed, and the outcome of the operation (if any) is provided to the calling code using an event notification, callback, or other means explained in the text. In a properly written program, this method does not throw any exceptions. You should therefore not put try/catch statements or similar constructs around calls to this method. The only exceptions thrown by this method are for usage errors, i.e. when your code violates the usage contract of the method, such as passing in invalid arguments or calling the method when the state of the object does not allow it. Any operation-related errors (i.e. errors that depend on external conditions that your code cannot reliably check) are indicated by the means the operation returns its outcome (if any), which is described in the text. For more information, see Do not catch any exceptions with asynchronous or multiple-operation methods.
Example
// This example shows how change the update rate of multiple existing subscriptions.

using System;
using System.Threading;
using OpcLabs.EasyOpc.DataAccess;
using OpcLabs.EasyOpc.DataAccess.OperationModel;

namespace DocExamples.DataAccess._EasyDAClient
{
    class ChangeMultipleItemSubscriptions
    {
        public static void Main1()
        {
            // Instantiate the client object.
            using (var client = new EasyDAClient())
            {
                client.ItemChanged += client_ItemChanged;

                Console.WriteLine("Subscribing...");
                int[] handleArray = client.SubscribeMultipleItems(new[]
                {
                    new DAItemGroupArguments("", "OPCLabs.KitServer.2", "Simulation.Random", 1000, null),
                    new DAItemGroupArguments("", "OPCLabs.KitServer.2", "Trends.Ramp (1 min)", 1000, null),
                    new DAItemGroupArguments("", "OPCLabs.KitServer.2", "Trends.Sine (1 min)", 1000, null),
                    new DAItemGroupArguments("", "OPCLabs.KitServer.2", "Simulation.Register_I4", 1000, null)
                });

                Console.WriteLine("Waiting for 10 seconds...");
                Thread.Sleep(10 * 1000);

                Console.WriteLine("Changing subscriptions...");
                client.ChangeMultipleItemSubscriptions(new[]
                {
                    new DAHandleGroupArguments(handleArray[0], 100),
                    new DAHandleGroupArguments(handleArray[1], 100)
                });

                Console.WriteLine("Waiting for 10 seconds...");
                Thread.Sleep(10 * 1000);

                Console.WriteLine("Unsubscribing...");
                client.UnsubscribeAllItems();

                Console.WriteLine("Waiting for 10 seconds...");
                Thread.Sleep(10 * 1000);
            }
        }

        // Item changed event handler
        static void client_ItemChanged(object sender, EasyDAItemChangedEventArgs e)
        {
            if (e.Succeeded)
                Console.WriteLine(e.Vtq);
            else
                Console.WriteLine($"*** Failure: {e.ErrorMessageBrief}");
        }
    }
}
Requirements

Target Platforms: .NET Framework: Windows 10 (selected versions), Windows 11 (selected versions), Windows Server 2012, Windows Server 2016; .NET Core, .NET 5, .NET 6: Linux, macOS, Microsoft Windows

See Also

Reference

IEasyDAClient Interface
IEasyDAClient Members