Create a NetLogic that fetches UI

Create a NetLogic that fetches UI elements from the OPC UA server.

Set the default external code editor. See Set the default code editor.

To create a NetLogic that fetches UI
  1. In Project view, right-click MainWindow (type) and select New > Runtime NetLogic.
  2. Hover-over the NetLogic, select Edit, and enter UIFetcher.
  3. Double-click the NetLogic.
    The external code editor opens.
  4. In the code editor, replace the existing code with the following code:
    #region StandardUsing
    using System;
    using FTOptix.Core;
    using FTOptix.CoreBase;
    using FTOptix.HMIProject;
    using UAManagedCore;
    using OpcUa = UAManagedCore.OpcUa;
    using FTOptix.NetLogic;
    using FTOptix.UI;
    using FTOptix.OPCUAServer;
    #endregion
    
    public class UIFetcher : FTOptix.NetLogic.BaseNetLogic
    {
        public override void Start()
        {
            myDelayedTask = new DelayedTask(LoadRemotePanel, 2000, LogicObject);
            myDelayedTask.Start();
        }
        public void LoadRemotePanel() {
            var clientPanelLoader = (PanelLoader)LogicObject.Owner.Get("ClientPanelLoader");
            var remoteMainPanel = Project.Current.Get("UI/RemotePanels/MainPanel");
            if (remoteMainPanel == null) {
                Log.Error("Remote server main panel not found");
                return;
            }
            clientPanelLoader.ChangePanel(remoteMainPanel.NodeId, NodeId.Empty);
        }
        [ExportMethod]
        public void ReloadRemote() {
            Start();
        }
        public override void Stop()
        {
            // Insert code to be executed when the user-defined logic is stopped
            myDelayedTask.Dispose();
        }
        private DelayedTask myDelayedTask;
    }
  5. Save the code.