OPC Studio User's Guide and Reference
AEAreaOrSourceDialog Class
Members  Example 



OpcLabs.EasyOpcForms Assembly > OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing Namespace : AEAreaOrSourceDialog Class
Displays a dialog box from which the user can select OPC-A&E event areas or sources.
Object Model
AEAreaOrSourceDialog ClassEasyAEClientSelector ClassAENodeDescriptor ClassServerDescriptor Class
Syntax
'Declaration
 
<CLSCompliantAttribute(True)>
<ComDefaultInterfaceAttribute(OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing.ComTypes._AEAreaOrSourceDialog)>
<ComVisibleAttribute(True)>
<GuidAttribute("2A807383-2668-4CBD-9662-345168250431")>
<TypeConverterAttribute(System.ComponentModel.ExpandableObjectConverter)>
<DesignerCategoryAttribute("Component")>
Public NotInheritable Class AEAreaOrSourceDialog 
   Inherits AEDialog
   Implements OpcLabs.BaseLib.Forms.ComTypes._FormCommonDialog, OpcLabs.BaseLib.Forms.ComTypes._SizableCommonDialog, OpcLabs.BaseLib.Licensing.ILicensingContextHolder, OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing.ComTypes._AEAreaOrSourceDialog, OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing.ComTypes._AEDialog, System.ComponentModel.IComponent, System.IDisposable 
'Usage
 
Dim instance As AEAreaOrSourceDialog
[CLSCompliant(true)]
[ComDefaultInterface(OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing.ComTypes._AEAreaOrSourceDialog)]
[ComVisible(true)]
[Guid("2A807383-2668-4CBD-9662-345168250431")]
[TypeConverter(System.ComponentModel.ExpandableObjectConverter)]
[DesignerCategory("Component")]
public sealed class AEAreaOrSourceDialog : AEDialog, OpcLabs.BaseLib.Forms.ComTypes._FormCommonDialog, OpcLabs.BaseLib.Forms.ComTypes._SizableCommonDialog, OpcLabs.BaseLib.Licensing.ILicensingContextHolder, OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing.ComTypes._AEAreaOrSourceDialog, OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing.ComTypes._AEDialog, System.ComponentModel.IComponent, System.IDisposable  
[CLSCompliant(true)]
[ComDefaultInterface(OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing.ComTypes._AEAreaOrSourceDialog)]
[ComVisible(true)]
[Guid("2A807383-2668-4CBD-9662-345168250431")]
[TypeConverter(System.ComponentModel.ExpandableObjectConverter)]
[DesignerCategory("Component")]
public ref class AEAreaOrSourceDialog sealed : public AEDialog, OpcLabs.BaseLib.Forms.ComTypes._FormCommonDialog, OpcLabs.BaseLib.Forms.ComTypes._SizableCommonDialog, OpcLabs.BaseLib.Licensing.ILicensingContextHolder, OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing.ComTypes._AEAreaOrSourceDialog, OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing.ComTypes._AEDialog, System.ComponentModel.IComponent, System.IDisposable  
Remarks

This is a modal dialog box; therefore, when shown, it blocks the rest of the application until the user has made a selection. When a dialog box is displayed modally, no input (keyboard or mouse click) can occur except to objects on the dialog box. The program must hide or close the dialog box (usually in response to some user action) before input to the calling program can occur.

 

General

Icon:

With AEAreaOrSourceDialog, your application can integrate a dialog box from which the user can select OPC-A&E event areas or sources:

The MultiSelect property determines whether the dialog allows the user to select multiple nodes as output.

Use the ServerDescriptor property to specify the OPC Alarms&Events server whose items are to be browsed, and call the ShowDialog method. If the result is equal to DialogResult.OK, the user has finished the selection, and information about it can be retrieved.

When the dialog is in single-select mode, you can obtain the information about the selected event area or source from the NodeDescriptor property. When the dialog is in multi-select mode, the information about the selected event areas is in the AreaElements property, and the information about the selected event sources in the SourceElements property; all event areas and nodes are available together in the NodeElements property.

Example

.NET

// This example shows how to let the user browse for OPC Alarms&Events areas or sources. 
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
// OPC client and subscriber examples in C# on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-CSharp .
// Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
// a commercial license in order to use Online Forums, and we reply to every post.

using System.Linq;
using System.Windows.Forms;
using OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing;

namespace FormsDocExamples._AEAreaOrSourceDialog
{
    static class ShowDialog
    {
        public static void Main1(IWin32Window owner)
        {
            var areaOrSourceDialog = new AEAreaOrSourceDialog
            {
                ServerDescriptor = {ServerClass = "OPCLabs.KitEventServer.2"}
            };

            DialogResult dialogResult = areaOrSourceDialog.ShowDialog(owner);
            if (dialogResult != DialogResult.OK)
                return;

            // Display results
            string nodeElementsString = string.Join("\n", areaOrSourceDialog.NodeElements.Select(element => element));
            MessageBox.Show(owner, nodeElementsString);
        }
    }
}
' This example shows how to let the user browse for OPC Alarms&Events areas or sources. 
'
' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
' OPC client and subscriber examples in VB.NET on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-VBNET .
' Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
' a commercial license in order to use Online Forums, and we reply to every post.

Imports OpcLabs.EasyOpc
Imports OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace
Imports OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing

Namespace FormsDocExamples._AEAreaOrSourceDialog
    Friend Class ShowDialog
        Shared Sub Main1(owner As IWin32Window)
            Dim areaOrSourceDialog = New AEAreaOrSourceDialog() With {
                .ServerDescriptor = New ServerDescriptor() With {
                    .ServerClass = "OPCLabs.KitEventServer.2"
                }
            }

            Dim dialogResult As DialogResult = areaOrSourceDialog.ShowDialog(owner)
            If dialogResult <> DialogResult.OK Then
                Return
            End If

            ' Display results
            Dim nodeElementsString As String = String.Join("\n", areaOrSourceDialog.NodeElements.Select(Function(element As AENodeElement) element))
            MessageBox.Show(owner, nodeElementsString)
        End Sub
    End Class
End Namespace

Python

# This example shows how to let the user browse for OPC Alarms&Events areas or sources.
#
# Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
# OPC client and subscriber examples in Python on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-Python .
# Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
# a commercial license in order to use Online Forums, and we reply to every post.
# The QuickOPC package is needed. Install it using "pip install opclabs_quickopc".
import opclabs_quickopc

# Import .NET namespaces.
from System.Windows.Forms import *
from OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing import *


areaOrSourceDialog = AEAreaOrSourceDialog()
areaOrSourceDialog.ServerDescriptor.ServerClass = "OPCLabs.KitEventServer.2"

dialogResult = areaOrSourceDialog.ShowDialog()
print(dialogResult)
if dialogResult != DialogResult.OK:
    exit()

# Display results.
print()
for nodeElement in areaOrSourceDialog.NodeElements:
    print(nodeElement)

 

Advanced

If you want to change the parameters of the client object the component uses to perform its OPC operations, you can use the ClientSelector Property.

 

 

Example
// This example shows how to let the user browse for OPC Alarms&Events areas or sources. 
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
// OPC client and subscriber examples in C# on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-CSharp .
// Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
// a commercial license in order to use Online Forums, and we reply to every post.

using System.Linq;
using System.Windows.Forms;
using OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing;

namespace FormsDocExamples._AEAreaOrSourceDialog
{
    static class ShowDialog
    {
        public static void Main1(IWin32Window owner)
        {
            var areaOrSourceDialog = new AEAreaOrSourceDialog
            {
                ServerDescriptor = {ServerClass = "OPCLabs.KitEventServer.2"}
            };

            DialogResult dialogResult = areaOrSourceDialog.ShowDialog(owner);
            if (dialogResult != DialogResult.OK)
                return;

            // Display results
            string nodeElementsString = string.Join("\n", areaOrSourceDialog.NodeElements.Select(element => element));
            MessageBox.Show(owner, nodeElementsString);
        }
    }
}
' This example shows how to let the user browse for OPC Alarms&Events areas or sources. 
'
' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
' OPC client and subscriber examples in VB.NET on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-VBNET .
' Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
' a commercial license in order to use Online Forums, and we reply to every post.

Imports OpcLabs.EasyOpc
Imports OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace
Imports OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing

Namespace FormsDocExamples._AEAreaOrSourceDialog
    Friend Class ShowDialog
        Shared Sub Main1(owner As IWin32Window)
            Dim areaOrSourceDialog = New AEAreaOrSourceDialog() With {
                .ServerDescriptor = New ServerDescriptor() With {
                    .ServerClass = "OPCLabs.KitEventServer.2"
                }
            }

            Dim dialogResult As DialogResult = areaOrSourceDialog.ShowDialog(owner)
            If dialogResult <> DialogResult.OK Then
                Return
            End If

            ' Display results
            Dim nodeElementsString As String = String.Join("\n", areaOrSourceDialog.NodeElements.Select(Function(element As AENodeElement) element))
            MessageBox.Show(owner, nodeElementsString)
        End Sub
    End Class
End Namespace
# This example shows how to let the user browse for OPC Alarms&Events areas or sources.
#
# Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
# OPC client and subscriber examples in Python on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-Python .
# Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
# a commercial license in order to use Online Forums, and we reply to every post.
# The QuickOPC package is needed. Install it using "pip install opclabs_quickopc".
import opclabs_quickopc

# Import .NET namespaces.
from System.Windows.Forms import *
from OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing import *


areaOrSourceDialog = AEAreaOrSourceDialog()
areaOrSourceDialog.ServerDescriptor.ServerClass = "OPCLabs.KitEventServer.2"

dialogResult = areaOrSourceDialog.ShowDialog()
print(dialogResult)
if dialogResult != DialogResult.OK:
    exit()

# Display results.
print()
for nodeElement in areaOrSourceDialog.NodeElements:
    print(nodeElement)
Inheritance Hierarchy

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Windows.Forms.CommonDialog
            OpcLabs.BaseLib.Forms.ConcreteCommonDialog
               OpcLabs.BaseLib.Forms.FormCommonDialog
                  OpcLabs.BaseLib.Forms.SizableCommonDialog
                     OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing.AEDialog
                        OpcLabs.EasyOpc.AlarmsAndEvents.Forms.Browsing.AEAreaOrSourceDialog

Requirements

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

See Also