Exemple #1
0
        protected void StopTest()
        {
            TestBench.Singleton.EmergencyStop();

            StopTestCommand.RaiseCanExecuteChanged();
            EditTestSettingsCommand.RaiseCanExecuteChanged();
        }
Exemple #2
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();
        }