protected override void StartTest()
        {
            {
                if (CanStartTest())
                {
                    DisplayTempMessage("Test in process...", GOOD_MESSAGE_BRUSH, 0);

                    FullyReversedTorqueTest test = Session.TestTemplate.TestInstance() as FullyReversedTorqueTest;

                    test.Operator  = Session.BenchOperator;
                    test.WorkOrder = Session.WorkId;

                    TestBench.Singleton.LoadTest(test);
                    TestBench.Singleton.BeginCurrentTest();

                    ChartFactory.CreateFullyReversedChart(TorqueAngleChart,
                                                          (test as FullyReversedTorqueTest).MinTorque,
                                                          (test as FullyReversedTorqueTest).MaxTorque);

                    ClearTestData();

                    // reevalutate all commands can execute.
                    StartTestCommand.RaiseCanExecuteChanged();
                    ExitProgamCommand.RaiseCanExecuteChanged();
                    StopTestCommand.RaiseCanExecuteChanged();
                }
            }
        }
Ejemplo n.º 2
0
        protected void StopTest()
        {
            TestBench.Singleton.EmergencyStop();

            StopTestCommand.RaiseCanExecuteChanged();
            EditTestSettingsCommand.RaiseCanExecuteChanged();
        }
Ejemplo 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();
        }
        protected override void StartTest()
        {
            {
                if (CanStartTest())
                {
                    DisplayTempMessage("Test in process...", GOOD_MESSAGE_BRUSH, 0);

                    UnidirectionalTorqueTest test = Session.TestTemplate.TestInstance() as UnidirectionalTorqueTest;

                    test.Operator  = Session.BenchOperator;
                    test.WorkOrder = Session.WorkId;

                    // used when creating the Unidirectional Chart to set the minimum or maximum y value.
                    int maxTorque = test.MaxTorque;

                    // set the test direction, based of what the user has chosen.
                    if (IsClockwise)
                    {
                        test.Direction = TestDirection.Clockwise;
                    }
                    else if (IsCounterclockwise)
                    {
                        maxTorque      = test.MinTorque; // CCW is negative
                        test.Direction = TestDirection.Counterclockwise;
                    }
                    else
                    {
                        test.Direction = TestDirection.Unknown;
                        throw new Exception("Unknown test direction, please change to Clockwise or Counterclockwise.");
                    }

                    TestBench.Singleton.LoadTest(test);
                    TestBench.Singleton.BeginCurrentTest();

                    ChartFactory.CreateUnidirectionalChart(TorqueAngleChart, maxTorque);

                    // clear all saved Sample objects from base class list.
                    ClearTestData();

                    // reevalutate all commands can execute.
                    StartTestCommand.RaiseCanExecuteChanged();
                    SaveDataCommand.RaiseCanExecuteChanged();
                    ExitProgamCommand.RaiseCanExecuteChanged();
                    StopTestCommand.RaiseCanExecuteChanged();
                }
            }
        }