Icon:
With UABrowseDialog, your application can integrate a dialog with various OPC-UA elements from which the user can select. This dialog can be configured to serve many different purposes.
Here is an example of the generic OPC-UA browsing dialog in action:
The way the dialog operates is controlled by two main properties:
Values of these properties can be selected from the UAElementType enumeration, which has members for various types of elements that you encounter when working with OPC-UA.
The following chart shows a hierarchy of element types that you can choose from:
For example, let’ say that you set Mode.AnchorElementType to Endpoint, and Mode.SelectElementType to Attribute. This will cause the dialog to allow the user to browse for an OPC-UA Node on a given server, and then for an OPC-UA attribute on that node.
In this case, before you run the dialog, you need to provide it with values for the InputsOutputs.CurrentNodeDescriptor.EndpointDescriptor property, because those define your “anchor” element (Endpoint) that the user cannot change. The dialog will only allow the user to finalize it (besides cancelling) after an OPC-UA attribute is fully selected, because that is your Mode.SelectElementType. After the dialog is successfully finalized, the information about the user’s choice will be available in the Outputs.CurrentNodeElement.NodeElement and InputsOutputs.CurrentNodeDescriptor.AttributeId properties.
Note that in addition to the “minimal” scenario described above, you can also pre-set the initial node or attribute, using the InputsOutputs.CurrentNodeDescriptor.NodeDescriptor or InputsOutputs.CurrentNodeDescriptor.AttributeId properties, and after the selection is made, these properties will be updated to the new selection as well. This way, if you run the dialog again with the same value, the initial selection will be where the user has left it the last time the dialog was run.
Obviously, the chosen Mode.SelectElementType must be a child or indirect ancestor of chosen Mode.AnchorElementType in the hierarchy.
It is also possible to configure the dialog for a multi-selection. In this mode, the user can select zero, one, or more nodes. In order to enable the multi-select mode, set the Mode.MultiSelect property to true. In the multi-select mode, the initial set of the selected nodes (when the dialog is first displayed to the user) is given by the contents of the InputOutputs.SelectionDescriptors collection. When the user makes the selection and accepts it by closing the dialog, this collection is updated, and also, all information about the selected nodes is placed to the Outputs.SelectionElements collection.
The output of one dialog invocation can be used as input to a subsequent dialog invocation.
Similarly, this can be achieved with multi-selection as well.
There are also ways to control some finer aspects of the dialog. For example, the Mode.ShowListBranches property (defaults to true) controls whether the branches of the tree are also displayed in the list view.
When you set the Simulated property of the dialog to true, the dialog will provide its contents from a pre-defined, simulated view of the world, with fake networks, computers, OPC servers, and their contents. This can be useful for experimentation and testing, either by the developer during the design (right in Visual Studio), or by the end-user (if you expose this functionality in your application), when the environment is not accessible.
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.