轮胎外观检测添加思谋语义分割模型检测工具
C3204
2026-03-30 06c627ec032b3f3876fd7db8a3ff0ff1a6614fa2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
using LB_VisionProcesses.Alogrithms.Halcon;
using LB_VisionProcesses.Alogrithms;
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 LB_SmartVision.ProcessRun;
 
namespace LB_SmartVision.Forms.Pages.ProcessPage
{
    public partial class ProcessInputsSelectForm : Form
    {
        List<ProcessInputsEditControl> listProcessInputsEditControl = new List<ProcessInputsEditControl>();
 
        ProcessRunBll ProcessRunBll { get; set; }
 
        public ProcessInputsSelectForm()
        {
            InitializeComponent();
        }
 
 
        public ProcessInputsSelectForm(string ProcessName, ProcessRunBll RunBll)
        {
            InitializeComponent();
            if (!RunBll.dicInputsMapping.ContainsKey(ProcessName))
                return;
 
            ProcessRunBll = RunBll;
 
            int index = 0;
            foreach (Tuple<string, string> tupleInputAndOutput in RunBll.dicInputsMapping[ProcessName])
            {
                string Input = tupleInputAndOutput.Item1;
                string Output = tupleInputAndOutput.Item2;
 
                ProcessInputsEditControl processInputsEditControl = new ProcessInputsEditControl(Input, Output, RunBll.dicInputsMapping, RunBll.dicOutputsMapping);
                listProcessInputsEditControl.Add(processInputsEditControl);
                this.panel.Controls.Add(processInputsEditControl);
                processInputsEditControl.Size = new System.Drawing.Size(panel.Width, 50);
                processInputsEditControl.Location = new System.Drawing.Point(0, processInputsEditControl.Size.Height * index);
                index++;
            }
        }
 
        private void panel_SizeChanged(object sender, EventArgs e)
        {
            int index = 0;
            foreach (var item in listProcessInputsEditControl)
            {
                item.Size = new System.Drawing.Size(panel.Width, 50);
                item.Location = new System.Drawing.Point(0, item.Size.Height * index);
                index++;
            }
        }
 
        private void ProcessInputsSelectForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (ProcessRunBll == null)
            {
                e.Cancel = false;  //确认关闭窗体
                return;
            }
 
            DialogResult res = MessageBox.Show("是否保存?", "提示", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);  //保存结果信息
            /// 参数1:显示文本,参数2:标题,参数3:按键类型,参数4:显示图标
            if (res != DialogResult.Yes && res != DialogResult.No)  //取消
            {
                e.Cancel = true;  //取消关闭窗体
                return;
            }
 
            if (res == DialogResult.Yes)  //保存
            {
                string ProcessName = this.Text;
                List<Tuple<string, string>> tupleInputAndOutput = new List<Tuple<string, string>>();
                foreach (var control in listProcessInputsEditControl)
                {
                    string strInput = control.lblInput.Text;
                    string strOutput = control.lblOutput.Text;
                    Tuple<string, string> tuple = Tuple.Create(strInput, strOutput);
                    tupleInputAndOutput.Add(tuple);
                }
 
                ProcessRunBll.dicInputsMapping.TryRemove(ProcessName, out _);
                ProcessRunBll.dicInputsMapping.TryAdd(ProcessName, tupleInputAndOutput);
                e.Cancel = false;  //确认关闭窗体
                return;
            }
        }
    }
}