public Form2() { InitializeComponent(); SystemCofigXml.LoadFile(); textBoxX1.Text = SystemCofigXml.IP; textBoxX2.Text = SystemCofigXml.Port.ToString(); }
private void button1_Click(object sender, EventArgs e) { Dictionary <string, string> updatitem = new Dictionary <string, string>(); updatitem.Add("IP", textBoxX1.Text); updatitem.Add("Port", textBoxX2.Text); SystemCofigXml.Update(ref updatitem); }
public Form1() { InitializeComponent(); SystemCofigXml.LoadFile(); textBoxX4.Text = SystemCofigXml.Type.ToString(); textBoxX5.Text = SystemCofigXml.StartAddress.ToString(); textBoxX6.Text = SystemCofigXml.Length.ToString(); textBoxX2.Text = SystemCofigXml.Value.ToString(); }
private void button2_Click(object sender, EventArgs e) { Dictionary <string, string> updatitem = new Dictionary <string, string>(); updatitem.Add("Type", textBoxX4.Text); updatitem.Add("StartAddress", textBoxX5.Text); updatitem.Add("Length", textBoxX6.Text); updatitem.Add("Value", textBoxX2.Text); SystemCofigXml.Update(ref updatitem); PLC_CMD plc_cmd = new PLC_CMD(Convert.ToInt32(textBoxX4.Text), Convert.ToInt32(textBoxX5.Text), Convert.ToInt32(textBoxX6.Text)); panasonicPLC.ReadHoldingRegister(3, plc_cmd.unit, plc_cmd.StartAddress, plc_cmd.Length); }
private void button3_Click(object sender, EventArgs e) { try { SystemCofigXml.LoadFile(); panasonicPLC = new PanasonicPLC(SystemCofigXml.IP, SystemCofigXml.Port, PLC_OnResponseData); panasonicPLC.Start(); } catch (SystemException error) { MessageBox.Show(error.Message); } }