轮胎外观检测添加思谋语义分割模型检测工具
C3204
16 小时以前 85a4bdc866f7ce0986d629820ef3e793f8b72787
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
99
100
101
102
103
104
105
106
107
108
109
110
 
using LB_VisionProcesses.Cameras;
using LB_VisionProcesses.Communicators;
using LB_VisionProcesses;
using LB_VisionProcesses.Alogrithms.Halcon;
using LB_VisionProcesses.Communicators;
using LB_SmartVision.Tool;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using ReaLTaiizor.Forms;
using RJCP.IO.Ports;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
 
 
namespace LB_SmartVision.Forms.Pages
{
    public partial class CreateProductForm : MaterialForm
    {
        public bool bCreate = false;
 
        public CreateProductForm()
        {
            InitializeComponent();
            // 禁止修改窗口大小
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
 
            uiButtonCreate.Enabled = false;
 
            btnDel.Click += (s, e) =>
            {
                LB_SmartVision.Tool.Tool.ReadStringConfig("产品列表", out string Products);
                List<string> lstProduct = (Products.Split(',')).ToList();
 
                if (string.IsNullOrEmpty(uiComboBoxProducts.Text)
                || lstProduct.Count <= 1 || !lstProduct.Contains(uiComboBoxProducts.Text))
                    return;
 
                lstProduct.Remove(uiComboBoxProducts.Text);
                LB_SmartVision.Tool.Tool.WriteConfig("产品列表", string.Join(",", lstProduct));
                Directory.Delete(Path.Combine(GlobalVar.strApplicationPath + "所有产品\\", uiComboBoxProducts.Text), true);
                this.Close();
            };
        }
 
        private void uiButtonTest_Click(object sender, EventArgs e)
        {
            uiButtonCreate.Enabled = false;
 
            LB_SmartVision.Tool.Tool.ReadStringConfig("产品列表", out string Products);
            List<string> lstProduct = (Products.Split(',')).ToList();
            if (lstProduct.Contains(uiTextBoxProductName.Text))
                MessageBox.Show($"产品[{uiTextBoxProductName.Text}]已存在!", "异常");
            else
                uiButtonCreate.Enabled = true;
        }
 
        private void uiButtonCreate_Click(object sender, EventArgs e)
        {
            if (LB_SmartVision.Tool.Tool.CopyDirectory(Path.Combine(GlobalVar.strApplicationPath + "所有产品\\", GlobalVar.strProductName)
                , Path.Combine(GlobalVar.strApplicationPath + "所有产品\\", uiTextBoxProductName.Text)))
            {
                LB_SmartVision.Tool.Tool.ReadStringConfig("产品列表", out string Products);
                List<string> lstProduct = (Products.Split(',')).ToList();
                lstProduct.Add(uiTextBoxProductName.Text);
                LB_SmartVision.Tool.Tool.WriteConfig("产品列表", string.Join(",", lstProduct));
                MessageBox.Show($"创建产品[{uiTextBoxProductName.Text}]成功!");
                this.Close();
            }
        }
 
        private void uiButtonCancel_Click(object sender, EventArgs e)
        {
            bCreate = false;
            this.Close();
        }
 
        private void uiComboBoxProducts_MouseClick(object sender, MouseEventArgs e)
        {
            uiButtonCreate.Enabled = false;
 
            uiComboBoxProducts.Items.Clear();
            uiComboBoxProducts.Items.Add("无");
 
            LB_SmartVision.Tool.Tool.ReadStringConfig("产品列表", out string Products);
            List<string> lstProduct = (Products.Split(',')).ToList();
            foreach (string DatabaseName in lstProduct)
            {
                uiComboBoxProducts.Items.Add(DatabaseName);
            }
        }
 
        private void uiTextBoxProductName_TextChanged(object sender, EventArgs e)
        {
            uiButtonCreate.Enabled = false;
        }
    }
}