Exemplo n.º 1
0
        private void TestPLC_Click(object sender, EventArgs e)
        {
            PLCPort.Open();


            using (TestPLCConn TP = new TestPLCConn())
            {
                TP.setSerialPort(PLCPort);
                if (TP.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    PLCPort.Close();
                }
            }
        }
        private void OperateButtonCommandExecute(object obj)
        {
            switch (obj.ToString())
            {
            case "0":
                addMessage("待添加功能");
                break;

            case "1":
                plc.SetM("M420", true);
                break;

            case "100":
                DXH.Ini.DXHIni.WritePrivateProfileString("PLC", "IP", PLCIP, iniParameterPath);
                DXH.Ini.DXHIni.WritePrivateProfileString("PLC", "PORT", PLCPort.ToString(), iniParameterPath);
                addMessage("参数保存成功");
                break;

            default:
                break;
            }
        }