Create a NetLogic that fetches panels
This NetLogic fetches a panel from the Server project and loads it in the Client project.
Prerequisites
Set the default external code editor. See Set the default code editor.
- InProject view, right-clickMainWindow (type)and select .
- Hover-over the NetLogic, selectEditPanelFetcher.
- Double-click the NetLogic.The external code editor opens.
- In the code editor, replace the existing code with the following code:#region Using directives using System; using UAManagedCore; using OpcUa = UAManagedCore.OpcUa; using FTOptix.HMIProject; using FTOptix.Retentivity; using FTOptix.NativeUI; using FTOptix.UI; using FTOptix.OPCUAClient; using FTOptix.Core; using FTOptix.CoreBase; using FTOptix.NetLogic; using FTOptix.UI; #endregion public class PanelFetcher : BaseNetLogic { public override void Start() { var importedPanel = Project.Current.Get("UI/Panels/Panel1"); if (importedPanel == null) { Log.Error("Could not find remote panel"); return; } var mainWindowPanelLoader = LogicObject.Owner.Get<FTOptix.UI.PanelLoader>("ClientPanelLoader"); // Change panel to the imported remote panel. mainWindowPanelLoader.ChangePanel(importedPanel.NodeId, NodeId.Empty); } public override void Stop() { // Insert code to be executed when the user-defined logic is stopped } }
- Save the code.
Provide Feedback