// This example shows how to let the user browse for multiple OPC-UA nodes.
using System.Windows.Forms;
using OpcLabs.EasyOpc.UA.Forms.Browsing;
namespace UAFormsDocExamples._UABrowseDialog
{
static partial class ShowDialog
{
public static void MultiSelect(IWin32Window owner)
{
var browseDialog = new UABrowseDialog();
browseDialog.InputsOutputs.CurrentNodeDescriptor.EndpointDescriptor.Host = "opcua.demo-this.com";
browseDialog.Mode.AnchorElementType = UAElementType.Host;
browseDialog.Mode.MultiSelect = true;
DialogResult dialogResult = browseDialog.ShowDialog(owner);
if (dialogResult != DialogResult.OK)
return;
// Display results
UABrowseNodeElementCollection selectionElements = browseDialog.Outputs.SelectionElements;
string text = "";
for (int i = 0; i < selectionElements.Count; i++)
{
UABrowseNodeElement selectionElement = selectionElements[i];
text += $"SelectionElements({i}): {selectionElement.NodeElement}\r\n";
}
MessageBox.Show(owner, text);
}
}
}
# This example shows how to let the user browse for an OPC-UA node.
# 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 *
browseDialog = UABrowseDialog()
browseDialog.InputsOutputs.CurrentNodeDescriptor.EndpointDescriptor.Host = 'opcua.demo-this.com'
browseDialog.Mode.AnchorElementType = UAElementType.Host
dialogResult = browseDialog.ShowDialog()
print(dialogResult)
if dialogResult != DialogResult.OK:
exit()
# Display results.
print(browseDialog.Outputs.CurrentNodeElement.NodeElement)
print('Finished.')