QuickOPC User's Guide and Reference
BrowseSources(IEasyAEClient,String,String,String) Method
Example 



OpcLabs.EasyOpcClassic Assembly > OpcLabs.EasyOpc.AlarmsAndEvents Namespace > IEasyAEClientExtension Class > BrowseSources Method : BrowseSources(IEasyAEClient,String,String,String) Method
The client object that will perform the operation.
Name of the machine. Determines the computer on which the OPC server is located. May be an empty string, in which case the OPC server is assumed to exist on the local computer or at the computer specified for it by DCOM configuration.
Contains ProgID of the OPC server.
Fully qualified name of the parent area to be browsed (empty string for root)
Browses the specified area (or root) in OPC server's process area space, and returns information about child sources found. Browses the specified area for child sources. Uses computer name and server class for specifying the OPC server. A parent area is passed in. No filtering.
Syntax
'Declaration
 
<ExtensionAttribute()>
<ElementsNotNullAttribute()>
<NotNullAttribute()>
Public Overloads Shared Function BrowseSources( _
   ByVal client As IEasyAEClient, _
   ByVal machineName As String, _
   ByVal serverClass As String, _
   ByVal parentQualifiedName As String _
) As AENodeElementCollection
'Usage
 
Dim client As IEasyAEClient
Dim machineName As String
Dim serverClass As String
Dim parentQualifiedName As String
Dim value As AENodeElementCollection
 
value = IEasyAEClientExtension.BrowseSources(client, machineName, serverClass, parentQualifiedName)
[Extension()]
[ElementsNotNull()]
[NotNull()]
public static AENodeElementCollection BrowseSources( 
   IEasyAEClient client,
   string machineName,
   string serverClass,
   string parentQualifiedName
)
[Extension()]
[ElementsNotNull()]
[NotNull()]
public:
static AENodeElementCollection^ BrowseSources( 
   IEasyAEClient^ client,
   String^ machineName,
   String^ serverClass,
   String^ parentQualifiedName
) 

Parameters

client
The client object that will perform the operation.
machineName
Name of the machine. Determines the computer on which the OPC server is located. May be an empty string, in which case the OPC server is assumed to exist on the local computer or at the computer specified for it by DCOM configuration.
serverClass
Contains ProgID of the OPC server.
parentQualifiedName
Fully qualified name of the parent area to be browsed (empty string for root)

Return Value

The method returns a keyed collection of OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace.AENodeElement values, each containing information about a particular source found. The keys of the keyed collection are the names of the sources.
Exceptions
ExceptionDescription
The OPC "Classic" (or OPC XML-DA) operation has failed.
A null reference (Nothing in Visual Basic) is passed to a method that does not accept it as a valid argument.
Example
// This example shows how to obtain all sources under the "Simulation" area.

using System;
using System.Diagnostics;
using OpcLabs.EasyOpc.AlarmsAndEvents;
using OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace;
using OpcLabs.EasyOpc.OperationModel;

namespace DocExamples.AlarmsAndEvents._EasyAEClient
{
    class BrowseSources
    {
        public static void Main1()
        {
            // Instantiate the client object.
            var client = new EasyAEClient();

            AENodeElementCollection nodeElements;
            try
            {
                nodeElements = client.BrowseSources("", "OPCLabs.KitEventServer.2", "Simulation");
            }
            catch (OpcException opcException)
            {
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message);
                return;
            }

            foreach (AENodeElement nodeElement in nodeElements)
            {
                Debug.Assert(nodeElement != null);

                Console.WriteLine("nodeElements[\"{0}\"]:", nodeElement.Name);
                Console.WriteLine("    .QualifiedName: {0}", nodeElement.QualifiedName);
            }
        }
    }
}
' This example shows how to obtain all sources under the "Simulation" area.

Imports OpcLabs.EasyOpc.AlarmsAndEvents
Imports OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace
Imports OpcLabs.EasyOpc.OperationModel

Namespace DocExamples.AlarmsAndEvents._EasyAEClient

    Friend Class BrowseSources
        Public Shared Sub Main1()
            Dim client = New EasyAEClient()

            Dim nodeElements As AENodeElementCollection
            Try
                nodeElements = client.BrowseSources("", "OPCLabs.KitEventServer.2", "Simulation")
            Catch opcException As OpcException
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message)
                Exit Sub
            End Try

            For Each nodeElement As AENodeElement In nodeElements
                Debug.Assert(nodeElement IsNot Nothing)

                Console.WriteLine("nodeElements[""{0}""]:", nodeElement.Name)
                Console.WriteLine("    .QualifiedName: {0}", nodeElement.QualifiedName)
            Next nodeElement
        End Sub
    End Class

End Namespace
// This example shows how to work with Software Tolbox TOP Server 5 Alarms and Events.
// Use simdemo_WithA&E.opf configuration file and write a value above 1000 to Channel1.Device1.Tag1 or Channel1.Device1.Tag2.

using System;
using System.Diagnostics;
using System.Threading;
using OpcLabs.EasyOpc.AlarmsAndEvents;
using OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace;
using OpcLabs.EasyOpc.AlarmsAndEvents.OperationModel;
using OpcLabs.EasyOpc.OperationModel;

namespace DocExamples.AlarmsAndEvents.SWToolbox
{
    class TOPServer_AE
    {
        public static void Main1()
        {
            // Instantiate the client object.
            var client = new EasyAEClient();

            // Browse for some areas and sources

            AENodeElementCollection areaElements;
            try
            {
                areaElements = client.BrowseAreas("", "SWToolbox.TOPServer_AE.V5", "");
            }
            catch (OpcException opcException)
            {
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message);
                return;
            }

            foreach (AENodeElement areaElement in areaElements)
            {
                Debug.Assert(!(areaElement is null));
                Debug.Assert(!(areaElement.QualifiedName is null));

                Console.WriteLine("areaElements[\"{0}\"]:", areaElement.Name);
                Console.WriteLine("    .QualifiedName: {0}", areaElement.QualifiedName);

                AENodeElementCollection sourceElements =
                    client.BrowseSources("", "SWToolbox.TOPServer_AE.V5", areaElement.QualifiedName);
                foreach (AENodeElement sourceElement in sourceElements)
                {
                    Debug.Assert(sourceElement != null);

                    Console.WriteLine("    sourceElements[\"{0}\"]:", sourceElement.Name);
                    Console.WriteLine("        .QualifiedName: {0}", sourceElement.QualifiedName);
                }
            }

            // Query for event categories

            AECategoryElementCollection categoryElements;
            try
            {
                categoryElements = client.QueryEventCategories("", "SWToolbox.TOPServer_AE.V5");
            }
            catch (OpcException opcException)
            {
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message);
                return;
            }

            foreach (AECategoryElement categoryElement in categoryElements)
            {
                Debug.Assert(categoryElement != null);
                Console.WriteLine("CategoryElements[\"{0}\"].Description: {1}", categoryElement.CategoryId,
                                  categoryElement.Description);
            }

            // Subscribe to events, wait, and unsubscribe

            var eventHandler = new EasyAENotificationEventHandler(client_Notification);
            client.Notification += eventHandler;

            int handle = client.SubscribeEvents("", "SWToolbox.TOPServer_AE.V5", 1000);

            Console.WriteLine("Processing event notifications for 1 minute...");
            Thread.Sleep(60 * 1000);

            client.UnsubscribeEvents(handle);
        }

        // Notification event handler
        static void client_Notification(object sender, EasyAENotificationEventArgs e)
        {
            if (!(e.Exception is null)) Console.WriteLine("e.Exception.Message: {0}", e.Exception.Message);
            if (!(e.Exception is null)) Console.WriteLine("e.Exception.Source: {0}", e.Exception.Source);
            Console.WriteLine("e.Refresh: {0}", e.Refresh);
            Console.WriteLine("e.RefreshComplete: {0}", e.RefreshComplete);
            if (!(e.EventData is null)) Console.WriteLine("e.EventData.QualifiedSourceName: {0}", e.EventData.QualifiedSourceName);
            if (!(e.EventData is null)) Console.WriteLine("e.EventData.Time: {0}", e.EventData.Time);
            if (!(e.EventData is null)) Console.WriteLine("e.EventData.Message: {0}", e.EventData.Message);
            if (!(e.EventData is null)) Console.WriteLine("e.EventData.EventType: {0}", e.EventData.EventType);
            if (!(e.EventData is null)) Console.WriteLine("e.EventData.CategoryId: {0}", e.EventData.CategoryId);
            if (!(e.EventData is null)) Console.WriteLine("e.EventData.Severity: {0}", e.EventData.Severity);
            if (!(e.EventData is null)) Console.WriteLine("e.EventData.ConditionName: {0}", e.EventData.ConditionName);
            if (!(e.EventData is null)) Console.WriteLine("e.EventData.SubconditionName: {0}", e.EventData.SubconditionName);
            if (!(e.EventData is null)) Console.WriteLine("e.EventData.Enabled: {0}", e.EventData.Enabled);
            if (!(e.EventData is null)) Console.WriteLine("e.EventData.Active: {0}", e.EventData.Active);
            if (!(e.EventData is null)) Console.WriteLine("e.EventData.Acknowledged: {0}", e.EventData.Acknowledged);
            if (!(e.EventData is null)) Console.WriteLine("e.EventData.Quality: {0}", e.EventData.Quality);
            if (!(e.EventData is null)) Console.WriteLine("e.EventData.AcknowledgeRequired: {0}", e.EventData.AcknowledgeRequired);
            if (!(e.EventData is null)) Console.WriteLine("e.EventData.ActiveTime: {0}", e.EventData.ActiveTime);
        }
    }
}
' This example shows how to work with Software Tolbox TOP Server 5 Alarms and Events.
' Use simdemo_WithA&E.opf configuration file and write a value above 1000 to Channel1.Device1.Tag1 or Channel1.Device1.Tag2.

Imports System.Threading
Imports OpcLabs.EasyOpc.AlarmsAndEvents
Imports OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace
Imports OpcLabs.EasyOpc.AlarmsAndEvents.OperationModel
Imports OpcLabs.EasyOpc.OperationModel

Namespace DocExamples.AlarmsAndEvents.SWToolbox

    Friend Class TOPServer_AE
        Public Shared Sub Main1()
            Dim client = New EasyAEClient()

            ' Browse for some areas and sources

            Dim areaElements As AENodeElementCollection
            Try
                areaElements = client.BrowseAreas("", "SWToolbox.TOPServer_AE.V5", "")
            Catch opcException As OpcException
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message)
                Exit Sub
            End Try

            For Each areaElement As AENodeElement In areaElements
                Debug.Assert(areaElement IsNot Nothing)
                Debug.Assert(areaElement.QualifiedName IsNot Nothing)

                Console.WriteLine("areaElements[""{0}""]:", areaElement.Name)
                Console.WriteLine("    .QualifiedName: {0}", areaElement.QualifiedName)

                Dim sourceElements As AENodeElementCollection = client.BrowseSources("", "SWToolbox.TOPServer_AE.V5", areaElement.QualifiedName)
                For Each sourceElement As AENodeElement In sourceElements
                    Debug.Assert(sourceElement IsNot Nothing)

                    Console.WriteLine("    sourceElements[""{0}""]:", sourceElement.Name)
                    Console.WriteLine("        .QualifiedName: {0}", sourceElement.QualifiedName)
                Next sourceElement
            Next areaElement

            ' Query for event categories

            Dim categoryElements As AECategoryElementCollection
            Try
                categoryElements = client.QueryEventCategories("", "SWToolbox.TOPServer_AE.V5")
            Catch opcException As OpcException
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message)
                Exit Sub
            End Try

            For Each categoryElement As AECategoryElement In categoryElements
                Debug.Assert(categoryElement IsNot Nothing)
                Console.WriteLine("CategoryElements[""{0}""].Description: {1}", categoryElement.CategoryId, categoryElement.Description)
            Next categoryElement

            ' Subscribe to events, wait, and unsubscribe

            Dim eventHandler = New EasyAENotificationEventHandler(AddressOf client_Notification)
            AddHandler client.Notification, eventHandler

            Dim handle As Integer = client.SubscribeEvents("", "SWToolbox.TOPServer_AE.V5", 1000)

            Console.WriteLine("Processing event notifications for 1 minute...")
            Thread.Sleep(60 * 1000)

            client.UnsubscribeEvents(handle)
        End Sub

        ' Notification event handler
        Private Shared Sub client_Notification(ByVal sender As Object, ByVal e As EasyAENotificationEventArgs)
            If e.Exception IsNot Nothing Then
                Console.WriteLine("e.Exception.Message: {0}", e.Exception.Message)
            End If
            If e.Exception IsNot Nothing Then
                Console.WriteLine("e.Exception.Source: {0}", e.Exception.Source)
            End If
            Console.WriteLine("e.Refresh: {0}", e.Refresh)
            Console.WriteLine("e.RefreshComplete: {0}", e.RefreshComplete)
            If e.EventData IsNot Nothing Then
                Console.WriteLine("e.EventData.QualifiedSourceName: {0}", e.EventData.QualifiedSourceName)
            End If
            If e.EventData IsNot Nothing Then
                Console.WriteLine("e.EventData.Time: {0}", e.EventData.Time)
            End If
            If e.EventData IsNot Nothing Then
                Console.WriteLine("e.EventData.Message: {0}", e.EventData.Message)
            End If
            If e.EventData IsNot Nothing Then
                Console.WriteLine("e.EventData.EventType: {0}", e.EventData.EventType)
            End If
            If e.EventData IsNot Nothing Then
                Console.WriteLine("e.EventData.CategoryId: {0}", e.EventData.CategoryId)
            End If
            If e.EventData IsNot Nothing Then
                Console.WriteLine("e.EventData.Severity: {0}", e.EventData.Severity)
            End If
            If e.EventData IsNot Nothing Then
                Console.WriteLine("e.EventData.ConditionName: {0}", e.EventData.ConditionName)
            End If
            If e.EventData IsNot Nothing Then
                Console.WriteLine("e.EventData.SubconditionName: {0}", e.EventData.SubconditionName)
            End If
            If e.EventData IsNot Nothing Then
                Console.WriteLine("e.EventData.Enabled: {0}", e.EventData.Enabled)
            End If
            If e.EventData IsNot Nothing Then
                Console.WriteLine("e.EventData.Active: {0}", e.EventData.Active)
            End If
            If e.EventData IsNot Nothing Then
                Console.WriteLine("e.EventData.Acknowledged: {0}", e.EventData.Acknowledged)
            End If
            If e.EventData IsNot Nothing Then
                Console.WriteLine("e.EventData.Quality: {0}", e.EventData.Quality)
            End If
            If e.EventData IsNot Nothing Then
                Console.WriteLine("e.EventData.AcknowledgeRequired: {0}", e.EventData.AcknowledgeRequired)
            End If
            If e.EventData IsNot Nothing Then
                Console.WriteLine("e.EventData.ActiveTime: {0}", e.EventData.ActiveTime)
            End If
        End Sub
    End Class

End Namespace
// This example shows how to obtain all sources under the "Simulation" area.

using System;
using System.Diagnostics;
using OpcLabs.EasyOpc.AlarmsAndEvents;
using OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace;
using OpcLabs.EasyOpc.OperationModel;

namespace DocExamples.AlarmsAndEvents._EasyAEClient
{
    class BrowseSources
    {
        public static void Main1()
        {
            // Instantiate the client object.
            var client = new EasyAEClient();

            AENodeElementCollection nodeElements;
            try
            {
                nodeElements = client.BrowseSources("", "OPCLabs.KitEventServer.2", "Simulation");
            }
            catch (OpcException opcException)
            {
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message);
                return;
            }

            foreach (AENodeElement nodeElement in nodeElements)
            {
                Debug.Assert(nodeElement != null);

                Console.WriteLine("nodeElements[\"{0}\"]:", nodeElement.Name);
                Console.WriteLine("    .QualifiedName: {0}", nodeElement.QualifiedName);
            }
        }
    }
}
' This example shows how to obtain all sources under the "Simulation" area.

Imports OpcLabs.EasyOpc.AlarmsAndEvents
Imports OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace
Imports OpcLabs.EasyOpc.OperationModel

Namespace DocExamples.AlarmsAndEvents._EasyAEClient

    Friend Class BrowseSources
        Public Shared Sub Main1()
            Dim client = New EasyAEClient()

            Dim nodeElements As AENodeElementCollection
            Try
                nodeElements = client.BrowseSources("", "OPCLabs.KitEventServer.2", "Simulation")
            Catch opcException As OpcException
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message)
                Exit Sub
            End Try

            For Each nodeElement As AENodeElement In nodeElements
                Debug.Assert(nodeElement IsNot Nothing)

                Console.WriteLine("nodeElements[""{0}""]:", nodeElement.Name)
                Console.WriteLine("    .QualifiedName: {0}", nodeElement.QualifiedName)
            Next nodeElement
        End Sub
    End Class

End Namespace
// This example shows how to work with Software Tolbox TOP Server 5 Alarms and Events.
// Use simdemo_WithA&E.opf configuration file and write a value above 1000 to Channel1.Device1.Tag1 or Channel1.Device1.Tag2.

using System;
using System.Diagnostics;
using System.Threading;
using OpcLabs.EasyOpc.AlarmsAndEvents;
using OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace;
using OpcLabs.EasyOpc.AlarmsAndEvents.OperationModel;
using OpcLabs.EasyOpc.OperationModel;

namespace DocExamples.AlarmsAndEvents.SWToolbox
{
    class TOPServer_AE
    {
        public static void Main1()
        {
            // Instantiate the client object.
            var client = new EasyAEClient();

            // Browse for some areas and sources

            AENodeElementCollection areaElements;
            try
            {
                areaElements = client.BrowseAreas("", "SWToolbox.TOPServer_AE.V5", "");
            }
            catch (OpcException opcException)
            {
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message);
                return;
            }

            foreach (AENodeElement areaElement in areaElements)
            {
                Debug.Assert(!(areaElement is null));
                Debug.Assert(!(areaElement.QualifiedName is null));

                Console.WriteLine("areaElements[\"{0}\"]:", areaElement.Name);
                Console.WriteLine("    .QualifiedName: {0}", areaElement.QualifiedName);

                AENodeElementCollection sourceElements =
                    client.BrowseSources("", "SWToolbox.TOPServer_AE.V5", areaElement.QualifiedName);
                foreach (AENodeElement sourceElement in sourceElements)
                {
                    Debug.Assert(sourceElement != null);

                    Console.WriteLine("    sourceElements[\"{0}\"]:", sourceElement.Name);
                    Console.WriteLine("        .QualifiedName: {0}", sourceElement.QualifiedName);
                }
            }

            // Query for event categories

            AECategoryElementCollection categoryElements;
            try
            {
                categoryElements = client.QueryEventCategories("", "SWToolbox.TOPServer_AE.V5");
            }
            catch (OpcException opcException)
            {
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message);
                return;
            }

            foreach (AECategoryElement categoryElement in categoryElements)
            {
                Debug.Assert(categoryElement != null);
                Console.WriteLine("CategoryElements[\"{0}\"].Description: {1}", categoryElement.CategoryId,
                                  categoryElement.Description);
            }

            // Subscribe to events, wait, and unsubscribe

            var eventHandler = new EasyAENotificationEventHandler(client_Notification);
            client.Notification += eventHandler;

            int handle = client.SubscribeEvents("", "SWToolbox.TOPServer_AE.V5", 1000);

            Console.WriteLine("Processing event notifications for 1 minute...");
            Thread.Sleep(60 * 1000);

            client.UnsubscribeEvents(handle);
        }

        // Notification event handler
        static void client_Notification(object sender, EasyAENotificationEventArgs e)
        {
            if (!(e.Exception is null)) Console.WriteLine("e.Exception.Message: {0}", e.Exception.Message);
            if (!(e.Exception is null)) Console.WriteLine("e.Exception.Source: {0}", e.Exception.Source);
            Console.WriteLine("e.Refresh: {0}", e.Refresh);
            Console.WriteLine("e.RefreshComplete: {0}", e.RefreshComplete);
            if (!(e.EventData is null)) Console.WriteLine("e.EventData.QualifiedSourceName: {0}", e.EventData.QualifiedSourceName);
            if (!(e.EventData is null)) Console.WriteLine("e.EventData.Time: {0}", e.EventData.Time);
            if (!(e.EventData is null)) Console.WriteLine("e.EventData.Message: {0}", e.EventData.Message);
            if (!(e.EventData is null)) Console.WriteLine("e.EventData.EventType: {0}", e.EventData.EventType);
            if (!(e.EventData is null)) Console.WriteLine("e.EventData.CategoryId: {0}", e.EventData.CategoryId);
            if (!(e.EventData is null)) Console.WriteLine("e.EventData.Severity: {0}", e.EventData.Severity);
            if (!(e.EventData is null)) Console.WriteLine("e.EventData.ConditionName: {0}", e.EventData.ConditionName);
            if (!(e.EventData is null)) Console.WriteLine("e.EventData.SubconditionName: {0}", e.EventData.SubconditionName);
            if (!(e.EventData is null)) Console.WriteLine("e.EventData.Enabled: {0}", e.EventData.Enabled);
            if (!(e.EventData is null)) Console.WriteLine("e.EventData.Active: {0}", e.EventData.Active);
            if (!(e.EventData is null)) Console.WriteLine("e.EventData.Acknowledged: {0}", e.EventData.Acknowledged);
            if (!(e.EventData is null)) Console.WriteLine("e.EventData.Quality: {0}", e.EventData.Quality);
            if (!(e.EventData is null)) Console.WriteLine("e.EventData.AcknowledgeRequired: {0}", e.EventData.AcknowledgeRequired);
            if (!(e.EventData is null)) Console.WriteLine("e.EventData.ActiveTime: {0}", e.EventData.ActiveTime);
        }
    }
}
' This example shows how to work with Software Tolbox TOP Server 5 Alarms and Events.
' Use simdemo_WithA&E.opf configuration file and write a value above 1000 to Channel1.Device1.Tag1 or Channel1.Device1.Tag2.

Imports System.Threading
Imports OpcLabs.EasyOpc.AlarmsAndEvents
Imports OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace
Imports OpcLabs.EasyOpc.AlarmsAndEvents.OperationModel
Imports OpcLabs.EasyOpc.OperationModel

Namespace DocExamples.AlarmsAndEvents.SWToolbox

    Friend Class TOPServer_AE
        Public Shared Sub Main1()
            Dim client = New EasyAEClient()

            ' Browse for some areas and sources

            Dim areaElements As AENodeElementCollection
            Try
                areaElements = client.BrowseAreas("", "SWToolbox.TOPServer_AE.V5", "")
            Catch opcException As OpcException
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message)
                Exit Sub
            End Try

            For Each areaElement As AENodeElement In areaElements
                Debug.Assert(areaElement IsNot Nothing)
                Debug.Assert(areaElement.QualifiedName IsNot Nothing)

                Console.WriteLine("areaElements[""{0}""]:", areaElement.Name)
                Console.WriteLine("    .QualifiedName: {0}", areaElement.QualifiedName)

                Dim sourceElements As AENodeElementCollection = client.BrowseSources("", "SWToolbox.TOPServer_AE.V5", areaElement.QualifiedName)
                For Each sourceElement As AENodeElement In sourceElements
                    Debug.Assert(sourceElement IsNot Nothing)

                    Console.WriteLine("    sourceElements[""{0}""]:", sourceElement.Name)
                    Console.WriteLine("        .QualifiedName: {0}", sourceElement.QualifiedName)
                Next sourceElement
            Next areaElement

            ' Query for event categories

            Dim categoryElements As AECategoryElementCollection
            Try
                categoryElements = client.QueryEventCategories("", "SWToolbox.TOPServer_AE.V5")
            Catch opcException As OpcException
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message)
                Exit Sub
            End Try

            For Each categoryElement As AECategoryElement In categoryElements
                Debug.Assert(categoryElement IsNot Nothing)
                Console.WriteLine("CategoryElements[""{0}""].Description: {1}", categoryElement.CategoryId, categoryElement.Description)
            Next categoryElement

            ' Subscribe to events, wait, and unsubscribe

            Dim eventHandler = New EasyAENotificationEventHandler(AddressOf client_Notification)
            AddHandler client.Notification, eventHandler

            Dim handle As Integer = client.SubscribeEvents("", "SWToolbox.TOPServer_AE.V5", 1000)

            Console.WriteLine("Processing event notifications for 1 minute...")
            Thread.Sleep(60 * 1000)

            client.UnsubscribeEvents(handle)
        End Sub

        ' Notification event handler
        Private Shared Sub client_Notification(ByVal sender As Object, ByVal e As EasyAENotificationEventArgs)
            If e.Exception IsNot Nothing Then
                Console.WriteLine("e.Exception.Message: {0}", e.Exception.Message)
            End If
            If e.Exception IsNot Nothing Then
                Console.WriteLine("e.Exception.Source: {0}", e.Exception.Source)
            End If
            Console.WriteLine("e.Refresh: {0}", e.Refresh)
            Console.WriteLine("e.RefreshComplete: {0}", e.RefreshComplete)
            If e.EventData IsNot Nothing Then
                Console.WriteLine("e.EventData.QualifiedSourceName: {0}", e.EventData.QualifiedSourceName)
            End If
            If e.EventData IsNot Nothing Then
                Console.WriteLine("e.EventData.Time: {0}", e.EventData.Time)
            End If
            If e.EventData IsNot Nothing Then
                Console.WriteLine("e.EventData.Message: {0}", e.EventData.Message)
            End If
            If e.EventData IsNot Nothing Then
                Console.WriteLine("e.EventData.EventType: {0}", e.EventData.EventType)
            End If
            If e.EventData IsNot Nothing Then
                Console.WriteLine("e.EventData.CategoryId: {0}", e.EventData.CategoryId)
            End If
            If e.EventData IsNot Nothing Then
                Console.WriteLine("e.EventData.Severity: {0}", e.EventData.Severity)
            End If
            If e.EventData IsNot Nothing Then
                Console.WriteLine("e.EventData.ConditionName: {0}", e.EventData.ConditionName)
            End If
            If e.EventData IsNot Nothing Then
                Console.WriteLine("e.EventData.SubconditionName: {0}", e.EventData.SubconditionName)
            End If
            If e.EventData IsNot Nothing Then
                Console.WriteLine("e.EventData.Enabled: {0}", e.EventData.Enabled)
            End If
            If e.EventData IsNot Nothing Then
                Console.WriteLine("e.EventData.Active: {0}", e.EventData.Active)
            End If
            If e.EventData IsNot Nothing Then
                Console.WriteLine("e.EventData.Acknowledged: {0}", e.EventData.Acknowledged)
            End If
            If e.EventData IsNot Nothing Then
                Console.WriteLine("e.EventData.Quality: {0}", e.EventData.Quality)
            End If
            If e.EventData IsNot Nothing Then
                Console.WriteLine("e.EventData.AcknowledgeRequired: {0}", e.EventData.AcknowledgeRequired)
            End If
            If e.EventData IsNot Nothing Then
                Console.WriteLine("e.EventData.ActiveTime: {0}", e.EventData.ActiveTime)
            End If
        End Sub
    End Class

End Namespace
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

IEasyAEClientExtension Class
IEasyAEClientExtension Members
Overload List