// This example shows how to let the user browse for multiple OPC-UA data nodes (data variables or properties).
using System;
using System.Linq;
using System.Windows.Forms;
using OpcLabs.EasyOpc.UA.Forms.Browsing;
namespace UAFormsDocExamples._UADataDialog
{
static partial class ShowDialog
{
public static void MultiSelect(IWin32Window owner)
{
var dataDialog = new UADataDialog
{
EndpointDescriptor = { UrlString = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer" },
// or "http://opcua.demo-this.com:51211/UA/SampleServer" (currently not supported)
// or "https://opcua.demo-this.com:51212/UA/SampleServer/"
MultiSelect = true,
UserPickEndpoint = true
};
DialogResult dialogResult = dataDialog.ShowDialog(owner);
if (dialogResult != DialogResult.OK)
return;
// Display results
MessageBox.Show(owner,
String.Join(Environment.NewLine, dataDialog.NodeElements.Select(element => element.ToString())));
}
}
}
# This example shows how to let the user browse for multiple OPC-UA data nodes (data variables or properties).
# 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.UA.Forms.Browsing import *
dataDialog = UADataDialog()
dataDialog.EndpointDescriptor.UrlString = 'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer'
# or 'http://opcua.demo-this.com:51211/UA/SampleServer' (currently not supported)
# or 'https://opcua.demo-this.com:51212/UA/SampleServer/'
dataDialog.MultiSelect = True
dataDialog.UserPickEndpoint = True
dialogResult = dataDialog.ShowDialog()
print(dialogResult)
if dialogResult != DialogResult.OK:
exit()
# Display results.
for nodeElement in dataDialog.NodeElements:
print(nodeElement)
print()
print('Finished.')