using LB_VisionProcesses; using OpenVinoSharp; using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using static System.Windows.Forms.VisualStyles.VisualStyleElement; namespace LB_SmartVision.Forms.Pages.ProcessPage { public partial class ProcessOutputsSelectForm : Form { public string SelectedOutput = string.Empty; public ProcessOutputsSelectForm() { InitializeComponent(); } public ProcessOutputsSelectForm(ConcurrentDictionary>> dicInputsMapping, ConcurrentDictionary> dicOutputsMapping, string ProcessName = "") { InitializeComponent(); treeViewOutputs.Nodes.Clear(); // 创建父节点 TreeNode nullNode = new TreeNode("无"); treeViewOutputs.Nodes.Add(nullNode); // 创建父节点 TreeNode globalNode = new TreeNode("全局变量"); foreach (var name in IProcess.dicGlobalVars.Keys) { // 创建子节点 TreeNode childNode1 = new TreeNode(name); globalNode.Nodes.Add(childNode1); } treeViewOutputs.Nodes.Add(globalNode); foreach (var item in dicOutputsMapping) { if (ProcessName != item.Key) { // 创建父节点 TreeNode parentNode = new TreeNode(item.Key); // 添加输入节点 TreeNode InputsNode = new TreeNode("Inputs"); List> listInputs = dicInputsMapping[item.Key]; foreach (var inputs in listInputs) { // 创建子节点 TreeNode childNode1 = new TreeNode(inputs.Item1); InputsNode.Nodes.Add(childNode1); } // 添加输出节点 TreeNode OutputsNode = new TreeNode("Outputs"); List listOutputs = item.Value; foreach (var output in listOutputs) { // 创建子节点 TreeNode childNode1 = new TreeNode(output); OutputsNode.Nodes.Add(childNode1); } // 将父节点添加到 TreeView parentNode.Nodes.Add(InputsNode); parentNode.Nodes.Add(OutputsNode); treeViewOutputs.Nodes.Add(parentNode); } } } private void uiButtonOK_Click(object sender, EventArgs e) { if (this.treeViewOutputs.SelectedNode == null) return; if (this.treeViewOutputs.SelectedNode.Text == "无") { SelectedOutput = string.Empty; this.Close(); } if (this.treeViewOutputs.SelectedNode.Parent != null) { SelectedOutput = this.treeViewOutputs.SelectedNode.Text; this.Close(); } } private void uiButtonCancel_Click(object sender, EventArgs e) { SelectedOutput = string.Empty; this.Close(); } } }