完成OpcUaService对数据类型的读取

This commit is contained in:
2025-09-02 14:37:43 +08:00
parent 9b7c91eae9
commit e0e48d3b71
10 changed files with 447 additions and 160 deletions

View File

@@ -116,15 +116,9 @@ public partial class ImportOpcUaDialogViewModel : DialogViewModelBase<List<Varia
private bool _isLoadingNodeVariables = false;
public async Task LoadNodeVariables(OpcUaNodeItemViewModel node)
{
// 防止重复加载
if (_isLoadingNodeVariables)
return;
_isLoadingNodeVariables = true;
try
{
@@ -158,6 +152,7 @@ public partial class ImportOpcUaDialogViewModel : DialogViewModelBase<List<Varia
Name = children.DisplayName, // 修正:使用子节点的显示名称
OpcUaNodeId = children.NodeId.ToString(),
Protocol = ProtocolType.OpcUa,
CSharpDataType=children.DataType,
IsActive = true // 默认选中
});
}
@@ -172,10 +167,6 @@ public partial class ImportOpcUaDialogViewModel : DialogViewModelBase<List<Varia
NlogHelper.Error($"加载 OPC UA 节点变量失败: {node.NodeId} - {ex.Message}", ex);
NotificationHelper.ShowError($"加载 OPC UA 节点变量失败: {node.NodeId} - {ex.Message}", ex);
}
finally
{
_isLoadingNodeVariables = false;
}
}