Esempio n. 1
0
        /// <summary>
        /// Do all test stand updating and re-activate if there have been any changes
        /// </summary>
        /// <param name="runContext">The context to use to run the activity</param>
        /// <param name="activityStatus">Call methods on this object to indicate state and progress of activity</param>
        public void Run(IActivityRunContext <IEmissionTestRunContext> runContext, IActivityStatus activityStatus)
        {
            _runContext     = runContext;
            _activityStatus = activityStatus;

            Test vtsTest = GetVetsTest();

            if (vtsTest.ID != TestStatus.RunningTests.Last().RunningTestID)
            {
                return;
            }

            try
            {
                string testID = vtsTest.CustomFieldValues.FirstOrDefault(p => p.CustomFieldID == "TestIDNumber").Value;
                UpdateVTSStatus(testID, "D");
                OnTestFinished();
                _activityStatus.Completed();
            }
            catch (Exception e)
            {
                if (!_aborted)
                {
                    _activityStatus.Failed(e);
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Do all test stand updating and re-activate if there have been any changes
        /// </summary>
        /// <param name="runContext">The context to use to run the activity</param>
        /// <param name="activityStatus">Call methods on this object to indicate state and progress of activity</param>
        public void Run(IActivityRunContext <IEmissionTestRunContext> runContext, IActivityStatus activityStatus)
        {
            _runContext     = runContext;
            _activityStatus = activityStatus;

            try
            {
                Test runningTest = EntityQuery.FirstOrDefault <Test>(x => x.ID == TestStatus.RunningTests.Last().RunningTestID);

                if (Config.ShowPopupOnTestStart && runningTest != null)
                {
                    List <PropertyInfo> properties = runningTest.GetType().GetProperties().ToList();
                    if (properties.Any(x => x.Name == "CycleRepeat"))
                    {
                        if (properties.FirstOrDefault(x => x.Name == "CycleRepeat").GetValue(runningTest, null).ToString() == "OperatorControlled")
                        {
                            ShowMessage(Config.PopupTitle, Config.PopupMessage);
                        }
                    }
                }
                _activityStatus.Completed();
            }
            catch (Exception e)
            {
                if (!_aborted)
                {
                    _activityStatus.Failed(e);
                }
            }
        }
        /// <summary>
        /// Do all test stand updating and re-activate if there have been any changes
        /// </summary>
        /// <param name="runContext">The context to use to run the activity</param>
        /// <param name="activityStatus">Call methods on this object to indicate state and progress of activity</param>
        public void Run(IActivityRunContext <IEmissionTestRunContext> runContext, IActivityStatus activityStatus)
        {
            _runContext     = runContext;
            _activityStatus = activityStatus;
            UpdateSystemState();

            try
            {
                _activityStatus.Completed();
            }
            catch (Exception e)
            {
                if (!_aborted)
                {
                    _activityStatus.Failed(e);
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Do all test stand updating and re-activate if there have been any changes
        /// </summary>
        /// <param name="runContext">The context to use to run the activity</param>
        /// <param name="activityStatus">Call methods on this object to indicate state and progress of activity</param>
        public void Run(IActivityRunContext <IEmissionTestRunContext> runContext, IActivityStatus activityStatus)
        {
            _runContext     = runContext;
            _activityStatus = activityStatus;

            try
            {
                Test runningTest = EntityQuery.FirstOrDefault <Test>(x => x.ID == TestStatus.RunningTests.Last().RunningTestID);
                Program.GetSocDataInParallel(runContext.TestRunContext.TestRunID, runningTest);
                activityStatus.Completed();
            }
            catch (Exception e)
            {
                if (!_aborted)
                {
                    activityStatus.Failed(e);
                }
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Do all test stand updating and re-activate if there have been any changes
        /// </summary>
        /// <param name="runContext">The context to use to run the activity</param>
        /// <param name="activityStatus">Call methods on this object to indicate state and progress of activity</param>
        public void Run(IActivityRunContext <IEmissionTestRunContext> runContext, IActivityStatus activityStatus)
        {
            _runContext     = runContext;
            _activityStatus = activityStatus;

            try
            {
                if (Config.CrossReferencePreconditionOnTestRun)
                {
                    Test vtsTest = GetVetsTest();
                    if (vtsTest.ID != TestStatus.RunningTests.Last().RunningTestID)
                    {
                        return;
                    }

                    Vehicle vtsVehicle = GetVetsVehicle();
                    string  vin        = vtsVehicle.CustomFieldValues.FirstOrDefault(p => p.CustomFieldID == "VIN").Value;

                    List <TestResult> testResults = GetTestResults();
                    if (testResults != null && testResults.Count > 0)
                    {
                        SelectPrecondition selectPrecondition = new SelectPrecondition(testResults, vin);
                        selectPrecondition.ShowDialog();
                        TestResult selectedTestRecord = selectPrecondition.SelectedTestRecord;
                        selectPrecondition.Dispose();
                        if (selectedTestRecord != null)
                        {
                            //vtsTest.CustomFieldValues.FirstOrDefault(x => x.CustomFieldID == "PreconditionTest").Value = selectedTestRecord.Name;
                            EntityManagerView.Lookup(Interfaces.Constants.ResourceType.Test).Value.Update(vtsTest.ID, vtsTest.Properties);
                        }
                    }
                }
                _activityStatus.Completed();
            }
            catch (Exception e)
            {
                if (!_aborted)
                {
                    _activityStatus.Failed(e);
                }
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Do all test stand updating and re-activate if there have been any changes
        /// </summary>
        /// <param name="runContext">The context to use to run the activity</param>
        /// <param name="activityStatus">Call methods on this object to indicate state and progress of activity</param>
        public void Run(IActivityRunContext <IEmissionTestRunContext> runContext, IActivityStatus activityStatus)
        {
            _runContext     = runContext;
            _activityStatus = activityStatus;

            try
            {
                foreach (Process proc in Process.GetProcesses())
                {
                    if (proc.ProcessName == "State of Charge Assessment")
                    {
                        proc.Kill();
                    }
                }
                _activityStatus.Completed();
            }
            catch (Exception e)
            {
                if (!_aborted)
                {
                    _activityStatus.Failed(e);
                }
            }
        }