public void TCPRecv_DeviceInit(byte[] data, int PackageLen) { bool result = false; int LastSendCmd = myApi.CurrentSendCmd; try { if (DEVICE_CMD_ID.RESET == LastSendCmd) { result = myApi.RecvTCPCmdResultCheck(data, out TCPReturnCode); if (result) { timerTCPRecv.Enabled = false; string name; if (0 == myApi.TargetType) { name = "Cr"; } else { name = "Cu"; } myApi.SetTarget(name); } } else if (DEVICE_CMD_ID.SET_TARGET == LastSendCmd) { result = myApi.RecvTCPCmdResultCheck(data, out TCPReturnCode); if (result) { timerTCPRecv.Enabled = false; // init end DetectorInitFinish(); } } } catch (Exception ex) { myUart.Pack_Debug_out(null, "Exception" + "[" + ex.ToString() + "]"); } }