PluginNavigation
Window Navigation
Plugins can open SCADA windows/pages programmatically using the Navigation service. This enables building interactive plugins that navigate users to detail pages, popups, or faceplates.
Navigation Service
Access navigation through host.Navigation:
|
Method |
Description |
|
OpenWindow(windowName) |
Opens a window with default settings |
|
OpenWindowWithOptions(options) |
Opens a window with specific options |
|
CloseCurrentWindow() |
Closes the window hosting the plugin |
|
CurrentWindowName |
Gets the name of the current window |
WindowOpenOptions Properties
|
Property |
Type |
Default |
Description |
|
WindowName |
String |
Required |
Window file name (e.g., "Details.edd") |
|
WindowTitle |
String |
null |
Custom window title |
|
IsPopup |
Boolean |
False |
Open as Popup window instead of normal |
|
IsFullScreen |
Boolean |
False |
Open in fullscreen mode |
|
KeepCurrentWindow |
Boolean |
True |
Keep current window open |
|
IsTopMost |
Boolean |
False |
Make popup on top of all windows |
|
ForceReload |
Boolean |
False |
Force reload even if already open |
|
DynamicPropertiesJson |
String |
null |
JSON dictionary for placeholder substitution |
|
LocationX / LocationY |
Integer? |
null |
Custom window location |
|
RequiredAccessLevel |
Integer |
0 |
Minimum access level required |
Basic Navigation Example
Open a window with default settings:
await _host.Navigation.OpenWindow("Details.edd");
Close current window:
_host.Navigation.CloseCurrentWindow();
Advanced Navigation with Dynamic Properties
Dynamic properties allow passing parameters to the target window. Placeholders in the target window's tag expressions (like {CONTROLLER_NAME}) are substituted with the provided values.
VB.NET Example:
Imports Newtonsoft.Json
Async Function OpenWindow() As Task
Try
' Check if navigation service is available
If _host Is Nothing OrElse _host.Navigation Is Nothing Then
MsgBox("Navigation service not available", MsgBoxStyle.Exclamation)
Return
End If
' Build dynamic properties dictionary
' Keys are placeholders (e.g., {CONTROLLER_NAME}) that will be substituted in the target window
' Values are the actual values to use
Dim dynamicProps As New Dictionary(Of String, String) From {
{"{CONTROLLER_NAME}", "C002"},
{"{CONTROLLER_ALARM}", "ControllerAlarms"},
{"{CONTROLLER_LABEL}", "C002_Label"}
}
' Serialize to JSON for the navigation service
Dim jsonDict As String = JsonConvert.SerializeObject(dynamicProps)
' Open as popup with dynamic properties
Dim options As New WindowOpenOptions With {
.WindowName = "Details.edd",
.WindowTitle = "Controller Details",
.IsPopup = True,
.IsTopMost = True,
.KeepCurrentWindow = True,
.RequiredAccessLevel = 0,
.DynamicPropertiesJson = jsonDict
}
Dim success = Await _host.Navigation.OpenWindowWithOptions(options)
If Not success Then
MsgBox("Failed to open window. Check if the page exists.", MsgBoxStyle.Exclamation)
End If
Catch ex As Exception
MsgBox($"Error opening window: {ex.Message}", MsgBoxStyle.Critical)
End Try
End Function
C# Example:
private async void OpenWindowWithDynamicProperties()
{
try
{
// Check if navigation service is available
if (_host?.Navigation == null)
{
MessageBox.Show("Navigation service not available", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
// Build dynamic properties dictionary
var dynamicProps = new Dictionary<string, string>
{
{ "{CONTROLLER_NAME}", "C002" },
{ "{CONTROLLER_ALARM}", "ControllerAlarms" },
{ "{CONTROLLER_LABEL}", "C002_Label" }
};
// Serialize to JSON for the navigation service
string jsonDict = JsonConvert.SerializeObject(dynamicProps);
// Open as popup with dynamic properties
var options = new WindowOpenOptions
{
WindowName = "Details.edd", // Replace with your target page name
WindowTitle = "Controller Details",
IsPopup = true,
IsTopMost = true,
KeepCurrentWindow = true,
RequiredAccessLevel = 0,
DynamicPropertiesJson = jsonDict
};
bool success = await _host.Navigation.OpenWindowWithOptions(options);
if (!success)
{
MessageBox.Show("Failed to open window. Check if the page exists or for access rights.",
"Navigation Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
catch (Exception ex)
{
MessageBox.Show($"Error opening window: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Critical);
}
}
How Dynamic Properties Work
- In the plugin: You create a dictionary mapping placeholders to values
- During navigation: The dictionary is passed to the target window
- In the target window: Tag expressions containing placeholders are substituted
For example, if the target window has a TextNode with expression {CONTROLLER_NAME}.Status, it becomes C002.Status.