private void btnConnect_Click(object sender, EventArgs e) { if (plc.isConnected) { plc.Disconnect(); if (plc.isThreadRun) { plc.stop(); } } else { plc.Connect(); if (!plc.isThreadRun) { plc.start(); } } }