private void QRCodeRecvData(object sender, EventArgs e) { if (e is QRCodeEventArgers) { QRCodeEventArgers Temp = e as QRCodeEventArgers; bool Check = WorkStation.CheckAndSaveQRCodeReadData(Temp.QRCodeRecv); if (Check) { WorkStation.m_ScanQRCode = true; } else { WorkStation.m_ScanQRCode = false; //再次扫描 } m_SyncContext.Post(SetQRCodeTextSafePost, Temp.QRCodeRecv); } }
private void QRCodeRecvData(object sender, EventArgs e) { if (e is QRCodeEventArgers) { QRCodeEventArgers Temp = e as QRCodeEventArgers; bool Check = VisualSortingStation.CheckAndSaveQRCodeReadData(Temp.QRCodeRecv); if (Check) { VisualSortingStation.m_ScanQRCode = true; } else { VisualSortingStation.m_ScanQRCode = false; m_ManualRobot.RunAction((int)RobotAction.Action_QRCodeScan); //再次扫描 } m_SyncContext.Post(SetQRCodeTextSafePost, Temp.QRCodeRecv); } }
private void DataReceivedHandler(object sender, SerialDataReceivedEventArgs e) { try { QRCodeEventArgers ev = new QRCodeEventArgers(); m_ReadString += ((SerialPort)sender).ReadExisting(); if (m_ReadString == m_ReadNone) { m_ReadString = string.Empty; } if (m_ReadString.Length == m_QRCodeCount) //二维码+\r\n { ev.QRCodeRecv = (string)m_ReadString.Clone(); m_ReadString = string.Empty; QRCodeRecvDataEvent?.Invoke(this, ev); } } catch (System.TimeoutException) { return; } }
public static void QRCodeRecvData(object sender, EventArgs e) { if (e is QRCodeEventArgers) { QRCodeEventArgers Temp = e as QRCodeEventArgers; bool Check = CheckAndSaveQRCodeReadData(Temp.QRCodeRecv); if (Check) { if (m_AutoRunAction == AutoRunAction.AuoRunNone) { m_ScanQRCode = true; m_AutoRunAction = AutoRunAction.AutoRunMoveToPut; } } else { if (m_AutoRunAction == AutoRunAction.AuoRunNone) //防止正确读取到后,再去放置的时候误触发时又要求重新去扫描 { m_ScanQRCode = false; m_AutoRunAction = AutoRunAction.AutoRunMoveToScanQRCode; } } } }