private void status() { while (!m_evtStatusCancel.WaitOne(1000)) { m_dfProgress = TestingProgressGet.GetProgress(); } }
private void status() { TestingProgressGet progress = new TestingProgressGet(); while (!m_evtStatusCancel.WaitOne(1000)) { m_dfProgress = progress.GetProgress(); } }
private void m_bw_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker bw = sender as BackgroundWorker; AutoTestParams param = e.Argument as AutoTestParams; AutoTestProgressInfo pi = new AutoTestProgressInfo(); TestClassCollection colTests = new TestClassCollection(); colTests.OnRunCompleted += colTests_OnRunCompleted; colTests.Load(param.TestDllFile); if (param.ResetAllTests) { colTests.ResetAllTests(); } else { colTests.LoadFromDatabase(); } try { colTests.Run(m_evtCancel, false, true, param.GpuId, param.ImageDbVersion, param.CudaPath); TestingProgressGet progress = new TestingProgressGet(); string strLast = null; while (!bw.CancellationPending && colTests.IsRunning) { Thread.Sleep(1000); string strCurrent = colTests.CurrentTest; double?dfProgress = progress.GetProgress(); if (strCurrent.Length > 0) { strCurrent = " [" + strCurrent + "]"; } if (dfProgress.HasValue) { strCurrent += " (" + dfProgress.Value.ToString("P") + " of current item)"; } pi.Set(colTests.PercentComplete, colTests.TotalTestTimingString + " completed " + colTests.TotalTestRunCount.ToString("N0") + " of " + colTests.TotalTestCount.ToString("N0") + " (" + colTests.TotalTestFailureCount.ToString("N0") + " failed)." + strCurrent); bw.ReportProgress((int)(pi.Progress * 100), pi); strLast = strCurrent; } } catch (Exception excpt) { pi.Set(excpt); bw.ReportProgress((int)(pi.Progress * 100), pi); } colTests.SaveToDatabase(); }