public void Execute(AscanQueueElement ascanQueueElement) { if (drawEvent != null) { drawEvent(dacMode, tof, ampPercent, dacPoint); } }
public void Execute(AscanQueueElement ascanQueueElement) { if (ascanDrawEvent != null) { FormList.MDIChild.Invoke(ascanDrawEvent, ascanQueueElement); } }
public UIThread(UIThreadEnv tmpEnv) { init = tmpEnv.init; clean = tmpEnv.clean; status = tmpEnv.status; ascanInList = tmpEnv.ascanInList; this.sessionsAttrs = tmpEnv.sessionsAttrs; ascanQueueElement = new AscanQueueElement(); thread = new Thread(UIFunc); thread.IsBackground = true; }
public AscanUIThread(AscanUIThreadEnv tmpEnv) { init = tmpEnv.init; clean = tmpEnv.clean; status = tmpEnv.status; ascanInList = tmpEnv.ascanInList; ascanQueueElement = new AscanQueueElement(); //timer = new System.Windows.Forms.Timer(); //timer.Interval = ConstParameter.AscanTimerInterval; //timer.Tick += new EventHandler(AscanUIFunc); thread = new Thread(AscanUIFunc); thread.IsBackground = true; }
public ParseThread(ParseThreadEnv tmpEnv) { timer.Elapsed += new System.Timers.ElapsedEventHandler(UpdateAscan); timer.AutoReset = true; init = tmpEnv.init; clean = tmpEnv.clean; status = tmpEnv.status; inputQueue = tmpEnv.captureOutQueue; ascanQueue = tmpEnv.ascanQueue; mergeInQueue = tmpEnv.mergeInQueue; mergeInQueueElement = new MergeInQueueElement(); ascanQueueElement = new AscanQueueElement(); boardStatusPacket = new BoardStatusSetPacket(); thread = new Thread(parseFunc); thread.IsBackground = true; updateCallBack = new updateDelegate(FormList.MDIChild.updateAscanbytimer); }
/**Parse thread function.*/ private void parseFunc() { //DEFINATION bool isDequeSuccess; bool isParseSuccess; //bool isError; CaptureOutQueueElement outqueueElement; //A queue atom represent the end of the ascan queue. AscanQueueElement ascanEndElement; //A queue atom represent the end of the mergein queue. MergeInQueueElement mergeInEndElement; //INIT isDequeSuccess = false; isParseSuccess = false; //isError = false; outqueueElement = new CaptureOutQueueElement(); ascanEndElement = new AscanQueueElement(); ascanEndElement.IsEnd = true; mergeInEndElement = new MergeInQueueElement(); mergeInEndElement.IsEnd = true; //PROCESSING init.handclasp_meet(); while (!GlobalQuit.Quit) { try { isDequeSuccess = inputQueue.Dequeue(ref outqueueElement); if (isDequeSuccess) { //if receive the end atom of queue, just break and stop the thread. if (outqueueElement.IsEnd == true) { break; } // LogFile.write("开始分发"); isParseSuccess = parsePacket(outqueueElement.setPacket); // LogFile.write("分发结束"); if (!isParseSuccess) { StackTrace st = new StackTrace(new StackFrame(true)); LogHelper.WriteLog("The format of packet is wrong or ParseThread timed out when Enqueue!", st); #if USE_WARNING MessageBox.Show("分发线程获取的数据格式错误或入队失败,请马上设置断点检查。位置:ParseThread.parseFunc"); #endif status = ThreadCondition.error; //isError = true; } } else { StackTrace st = new StackTrace(new StackFrame(true)); LogHelper.WriteLog("ParseThread timed out when Dequeue!", st); #if USE_WARNING MessageBox.Show("分发线程出队超时,请马上设置断点检查。位置:ParseThread.parseFunc"); #endif status = ThreadCondition.error; // isError = true; } } catch (Exception e) { StackTrace st = new StackTrace(new StackFrame(true)); LogHelper.WriteLog(e, st); #if USE_WARNING MessageBox.Show("检测到异常,请马上设置断点检查。位置:ParseThread.parseFunc"); #endif status = ThreadCondition.error; //isError = true; } } init.handclasp_force(); //ascanQueue.EnqueueWithSemaphor(ascanEndElement); //mergeInQueue.EnqueueWithSemaphor(mergeInEndElement); clean.handclasp_meet(); status = ThreadCondition.exit; }