private void Singleton_TestCompleted(object sender, TorqueTestEventArgs e) { try { FullyReversedTorqueTest completedTest = e.Test as FullyReversedTorqueTest; // normalize the data to the min and max torque, so it's easy to compare to actual // test results. CurrentCalibration.CalculateCalibrationValues(completedTest.CopyOfData, completedTest.MaxTorque, completedTest.MinTorque); // update UI CwValue = CurrentCalibration.NominalCwDeflection; CcwValue = CurrentCalibration.NominalCcwDeflection; CurrentCalibration.CalibratedByClockId = MainWindow_VM.Instance.TestSession.BenchOperator.ClockId; int recordsAffected = CurrentCalibration.Save(); // so the calibration is enabled again. _calibrationCanBegin = true; RunCalibrationCommand.RaiseCanExecuteChanged(); Message = "Calibration completed. Going to test panel shortly."; DispatcherTimer t = new DispatcherTimer(); t.Interval = new TimeSpan(0, 0, 0, 5); t.Tick += T_Tick; t.Start(); } catch (Exception ex) { ExceptionHandler.WriteToEventLog(ex); } }
private void RunCalibration() { _calibrationCanBegin = false; RunCalibrationCommand.RaiseCanExecuteChanged(); _canGoBack = false; PreviousScreenCommand.RaiseCanExecuteChanged(); Message = "Calibration in process..."; // save calibration to server. TorqueTestVm.PrepareToTest(MainWindow_VM.Instance.TestSession); TorqueTestVm.StartTestCommand.Execute(new FullyReversedTorqueTest()); TestBench.Singleton.TestCompleted += Singleton_TestCompleted; }