Exemplo n.º 1
0
 protected void TestBench_TestStarted(object sender, TorqueTestEventArgs e)
 {
     if (e.Test != null)
     {
         IsTestIdNeeded = false;
     }
 }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
        protected void TestBench_TestCompleted(object sender, TorqueTestEventArgs e)
        {
            if (e.Test != null)
            {
                if (e.Test.ShouldBeSaved && Session != null)
                {
                    if (e.Test is UnidirectionalTorqueTest)
                    {
                        // make the control appear which the user can use
                        // to enter the torque test id.
                        IsTestIdNeeded = true;

                        DisplayTempMessage(Messages.ScanBarcodeMessage(), GOOD_MESSAGE_BRUSH, 0);
                    }
                    else
                    {
                        // here is the spot that we check if actual test results fall within a
                        // certain limit of the calibrated item.
                        TestResultAnalyzer testAnalyst = new TestResultAnalyzer();
                        string             testResult;
                        if (testAnalyst.CannotAcceptResults(e.Test, Session.WorkId, out testResult))
                        {
                            // set these quick, so they will return to these after the
                            // temporary test result error message.
                            Instructions           = Business.Shared.Messages.StartButtonMessage();
                            MessageBackgroundColor = GOOD_MESSAGE_BRUSH;

                            DisplayTempMessage(testResult, TEST_FAILURE_BRUSH, 30);
                            e.Test.ShouldBeSaved = false;

                            // get ready to start another test.
                            ClearPointsFromChart();
                        }
                        else
                        {
                            // make the control appear which the user can use
                            // to enter the torque test id.
                            IsTestIdNeeded = true;

                            DisplayTempMessage(Messages.ScanBarcodeMessage(), GOOD_MESSAGE_BRUSH, 0);
                        }
                    }
                }
            }
            else
            {
                DisplayTempMessage(Messages.StartButtonMessage(), GOOD_MESSAGE_BRUSH, 0);
                DisplayTempMessage(Messages.TestCancelledMessage(), ERROR_BRUSH, 3);

                ClearPointsFromChart();
                // start a new test, the user cancelled the current one.
            }

            // order is important, do Stop THEN Start
            StopTestCommand.RaiseCanExecuteChanged();
            StartTestCommand.RaiseCanExecuteChanged();
            ExitProgamCommand.RaiseCanExecuteChanged();
            EditTestSettingsCommand.RaiseCanExecuteChanged();
        }