|
@@ -6,6 +6,7 @@ using static OTSDataType.otsdataconst;
|
|
|
|
|
|
using OTSModelSharp.ImageProcess;
|
|
|
using OTSModelSharp.ServiceInterface;
|
|
|
+using System.Threading;
|
|
|
|
|
|
namespace OTSModelSharp
|
|
|
{
|
|
@@ -231,11 +232,6 @@ namespace OTSModelSharp
|
|
|
public void DoMeasure()
|
|
|
{
|
|
|
// start measurement, creat thread measure status class, let the main thread know that measurement started
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
m_ThreadStatus.SetStartTime(System.DateTime.Now);
|
|
|
DateTime timeStart = m_ThreadStatus.GetStartTime();
|
|
|
|
|
@@ -278,11 +274,30 @@ namespace OTSModelSharp
|
|
|
ThreadOver();
|
|
|
return;
|
|
|
}
|
|
|
+ if (m_ThreadStatus.GetStatus() == OTS_MSR_THREAD_STATUS.PAUSED)
|
|
|
+ {
|
|
|
+ // stop button clicked
|
|
|
+ loger.Info("DoMeasure: stop button is clicked.");
|
|
|
+ // record end time
|
|
|
+ m_ThreadStatus.ComputeTime(OTS_THREAD_TIME_TYPE.STOPPED);
|
|
|
+ while (m_ThreadStatus.GetStatus() == OTS_MSR_THREAD_STATUS.PAUSED)
|
|
|
+ {
|
|
|
+ Thread.Sleep(300);
|
|
|
+
|
|
|
+ }
|
|
|
+ //return;
|
|
|
+ }
|
|
|
|
|
|
if (!pSample.GetSwitch())
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
+ var sta = pSample.GetMsrStatus().GetStatus();
|
|
|
+ if (sta == OTS_MSR_SAMPLE_STATUS.SUCCESSED || sta == OTS_MSR_SAMPLE_STATUS.STOPPED)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
CSmplMeasure pSmplMeasure;
|
|
|
if (!mapSmplMsr.ContainsKey(pSample.GetName()))
|
|
@@ -322,6 +337,8 @@ namespace OTSModelSharp
|
|
|
pSmplMeasure.DoMeasureForOneSample();
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
// check if measurement is successful
|
|
|
if (pSample.GetMsrStatus().GetStatus() == OTS_MSR_SAMPLE_STATUS.PAUSED)
|
|
|
{// record end time
|
|
@@ -356,7 +373,7 @@ namespace OTSModelSharp
|
|
|
|
|
|
|
|
|
ThreadOver();
|
|
|
- return;
|
|
|
+ break;
|
|
|
}
|
|
|
else if (pSample.GetMsrStatus().GetStatus() == OTS_MSR_SAMPLE_STATUS.FAILED)
|
|
|
{
|
|
@@ -377,19 +394,18 @@ namespace OTSModelSharp
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- // record end time
|
|
|
- m_ThreadStatus.ComputeTime(OTS_THREAD_TIME_TYPE.STOPPED);
|
|
|
+
|
|
|
+ // update thread measure status class, let the main thread know that this sample measurement successes
|
|
|
+ ST_MSTMsg MsgSmpSuccess = new ST_MSTMsg();
|
|
|
+ MsgSmpSuccess.iMsgType = ENUM_MSG_TYPE.MSAMPLESTATUS;
|
|
|
+ MsgSmpSuccess.STMSampleStu.iMsrSampleStatu = OTS_MSR_SAMPLE_STATUS.SUCCESSED;
|
|
|
+ ProgressEvent(MsgSmpSuccess);
|
|
|
|
|
|
- // update thread measure status class, let the main thread know that this sample measurement successes
|
|
|
- ST_MSTMsg MsgSmpSuccess=new ST_MSTMsg();
|
|
|
- MsgSmpSuccess.iMsgType = ENUM_MSG_TYPE.MSAMPLESTATUS;
|
|
|
- MsgSmpSuccess.STMSampleStu.iMsrSampleStatu = OTS_MSR_SAMPLE_STATUS.SUCCESSED;
|
|
|
- ProgressEvent(MsgSmpSuccess);
|
|
|
-
|
|
|
|
|
|
- // continue to the next sample
|
|
|
- listMeasuredSamples.Add (pSample.GetName());
|
|
|
- }
|
|
|
+ // continue to the next sample
|
|
|
+ listMeasuredSamples.Add(pSample.GetName());
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
// measurement completed
|
|
|
m_ThreadStatus.SetStatus(OTS_MSR_THREAD_STATUS.COMPLETED);
|