创建用于获取 UI 的 NetLogic

创建用于从 OPC UA 服务器获取 UI 元素的 NetLogic。
设置默认外部代码编辑器。请参见设置默认代码编辑器
  1. 创建用于获取 UI 的 NetLogic
  2. 项目视图
    中,右键单击
    MainWindow (type)
    ,然后选择
    新建
    运行时 NetLogic
  3. 将光标悬停在 NetLogic 上,选择
    Edit
    并输入
    UIFetcher
  4. 双击 NetLogic。
    外部代码编辑器将打开。
  5. 在代码编辑器中,使用以下代码替换现有代码:
    #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; }
  6. 保存代码。
提供反馈
对本文档有问题或反馈吗? 请在这里提交您的反馈