133 lines
5.2 KiB
C#
133 lines
5.2 KiB
C#
using Newtonsoft.Json.Linq;
|
|
using System;
|
|
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;
|
|
|
|
namespace AssistClient
|
|
{
|
|
public partial class FrmSetParams : Form
|
|
{
|
|
public string ParamsData;
|
|
private string ProcessCode;
|
|
private string ProcessParams;
|
|
|
|
private UI.UICodeScannerDev uiCodeScanner1;
|
|
private UI.UIAxisDev uiAxis1;
|
|
private UI.UIIOCardDev uiIOCard1;
|
|
private UI.UILightDev uiLight1;
|
|
private UI.UIScannerDev uiScanner1;
|
|
private UI.UISizeLib uiSizeLib1;
|
|
private UI.UIForLib uiForLib1;
|
|
private UI.UIIFLib uiIFLib1;
|
|
public FrmSetParams(string processCode,string processParams)
|
|
{
|
|
InitializeComponent();
|
|
ProcessCode= processCode;
|
|
ProcessParams= processParams;
|
|
}
|
|
private void initData()
|
|
{
|
|
switch (ProcessCode)
|
|
{
|
|
case "CodeScanner":
|
|
uiCodeScanner1= new UI.UICodeScannerDev();
|
|
this.Controls.Add(uiCodeScanner1);
|
|
uiCodeScanner1.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
uiCodeScanner1.Location = new System.Drawing.Point(0, 0);
|
|
uiCodeScanner1.init();
|
|
break;
|
|
case "IOCard":
|
|
uiIOCard1 = new UI.UIIOCardDev();
|
|
this.Controls.Add(uiIOCard1);
|
|
uiIOCard1.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
uiIOCard1.Location = new System.Drawing.Point(0, 0);
|
|
uiIOCard1.GetParamsEvent = save;
|
|
uiIOCard1.init();
|
|
uiIOCard1.setParamsData(ProcessParams);
|
|
break;
|
|
case "Axis":
|
|
uiAxis1 = new UI.UIAxisDev();
|
|
this.Controls.Add(uiAxis1);
|
|
uiAxis1.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
uiAxis1.Location = new System.Drawing.Point(0, 0);
|
|
uiAxis1.GetParamsEvent = save;
|
|
uiAxis1.init();
|
|
uiAxis1.setParamsData(ProcessParams);
|
|
break;
|
|
case "Light":
|
|
uiLight1 = new UI.UILightDev();
|
|
this.Controls.Add(uiLight1);
|
|
uiLight1.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
uiLight1.Location = new System.Drawing.Point(0, 0);
|
|
uiLight1.GetParamsEvent = save;
|
|
uiLight1.init();
|
|
uiLight1.setParamsData(ProcessParams);
|
|
break;
|
|
case "Scanner_CC":
|
|
uiScanner1 = new UI.UIScannerDev();
|
|
this.Controls.Add(uiScanner1);
|
|
uiScanner1.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
uiScanner1.Location = new System.Drawing.Point(0, 0);
|
|
uiScanner1.GetParamsEvent = save;
|
|
uiScanner1.init(Device.ScannerDev.ScannerType.CC);
|
|
uiScanner1.setParamsData(ProcessParams);
|
|
break;
|
|
case "Size":
|
|
uiSizeLib1 = new UI.UISizeLib();
|
|
this.Controls.Add(uiSizeLib1);
|
|
uiSizeLib1.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
uiSizeLib1.Location = new System.Drawing.Point(0, 0);
|
|
uiSizeLib1.GetParamsEvent = save;
|
|
uiSizeLib1.init();
|
|
uiSizeLib1.setParamsData(ProcessParams);
|
|
break;
|
|
case "For":
|
|
uiForLib1 = new UI.UIForLib();
|
|
this.Controls.Add(uiForLib1);
|
|
uiForLib1.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
uiForLib1.Location = new System.Drawing.Point(0, 0);
|
|
uiForLib1.GetParamsEvent = save;
|
|
uiForLib1.init();
|
|
uiForLib1.setParamsData(ProcessParams);
|
|
break;
|
|
case "If":
|
|
uiIFLib1 = new UI.UIIFLib();
|
|
this.Controls.Add(uiIFLib1);
|
|
uiIFLib1.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
uiIFLib1.Location = new System.Drawing.Point(0, 0);
|
|
uiIFLib1.GetParamsEvent = save;
|
|
uiIFLib1.init();
|
|
uiIFLib1.setParamsData(ProcessParams);
|
|
break;
|
|
default:
|
|
throw new Exception("不支持的工序类型!");
|
|
}
|
|
}
|
|
|
|
private void FrmSetParams_Load(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
initData();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
this.Close();
|
|
}
|
|
}
|
|
private void save(string json)
|
|
{
|
|
this.ParamsData = json;
|
|
this.DialogResult = DialogResult.OK;
|
|
this.Close();
|
|
}
|
|
}
|
|
}
|