创建用于获取面板的 NetLogic

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