예제 #1
0
        private void rds_ReceiveDataHandler(String strComReciveData)
        {
            try
            {
                Thread.Sleep(200);
                receiveText.Append(strComReciveData);
                //判断是否结束
                if (comHelp.isComplete())
                {
                    if (!button1.Enabled)
                    {
                        Util.write2File("data/" + sampleModel.sampleNo + ".txt", receiveText.ToString(), System.IO.FileMode.Append, System.IO.FileAccess.Write);
                        SetData(receiveText.ToString());
                    }
                    else
                    {
                        receiveText.Length = 0;
                        comHelp.ClearDataInBuffer();
                    }
                }

                //清空缓存
                // comHelp.ClearDataInBuffer();
            }
            catch (Exception ex)
            {
                log.Debug(ex.ToString());
                Thread.Sleep(200);
            }
        }