|
using LB_SmartVision.SQL;
|
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
|
{
|
public partial class CreateProductForm : Form
|
{
|
public List<string> listDatabaseName { get; set; }
|
public bool bCreate = false;
|
|
public CreateProductForm(List<string> listDatabaseNam = null)
|
{
|
InitializeComponent();
|
// 禁止修改窗口大小
|
//this.FormBorderStyle = FormBorderStyle.FixedDialog;
|
|
uiButtonCreate.Enabled = false;
|
if (listDatabaseNam == null)
|
listDatabaseNam = LB_SqlCommand.GetUserDatabases();
|
|
this.listDatabaseName = listDatabaseNam;
|
}
|
|
|
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;
|
}
|
}
|
}
|