Ejemplo n.º 1
0
        public void CancelScanMethod()
        {
            // Set Cancel Flag
            cancelRunningExperiments = true;

            // Abort currently running Experiment
            if ((experimentRunning != -1) && (scanMethod != null) && (scanMethod.Count > experimentRunning))
            {
                IExperiment exp = scanMethod[experimentRunning];
                exp.Abort();
            }
        }
Ejemplo n.º 2
0
        private void RunNextExperiment(int expIndex)
        {
            IExperiment exp = (IExperiment)scanMethod[expIndex];

            log.Add("Configuring " + ((ParametrizableObject)exp).Name + "...");
            enExperimentStatus expStatus = exp.Configure(null, scanMethodResultsPath);

            if ((expStatus != enExperimentStatus.OK) && (expStatus != enExperimentStatus.Idle))
            {
                log.Warning("Experiment Sequence Aborted due to exp.Configure() returning: " + expStatus);
                OnNotifyScanEnded(new ExperimentEndedEventArgs(enExperimentStatus.Error, null));
            }

            exp.NotifyExperimentDataUpdated -= Exp_NotifyExperimentDataUpdated;
            exp.NotifyExperimentDataUpdated += Exp_NotifyExperimentDataUpdated;
            exp.NotifyExperimentEnded       -= Exp_NotifyExperimentEnded;
            exp.NotifyExperimentEnded       += Exp_NotifyExperimentEnded;
            experimentRunning     = expIndex;
            experimentRunningName = (scanMethod[experimentRunning] as ParametrizableObject).Name;

            log.Add("Running " + ((ParametrizableObject)exp).Name + "...");
            expStatus = exp.Run();
            if ((expStatus != enExperimentStatus.OK) && (expStatus != enExperimentStatus.Running))
            {
                exp.NotifyExperimentDataUpdated -= Exp_NotifyExperimentDataUpdated;
                exp.NotifyExperimentEnded       -= Exp_NotifyExperimentEnded;
                try
                {
                    // just in case Experiment was started
                    exp.Abort();
                }
                catch (Exception e)
                {
                }
                log.Warning("Experiment Sequence Aborted due to exp.Run() returning: " + expStatus);
                OnNotifyScanEnded(new ExperimentEndedEventArgs(enExperimentStatus.Error, null));
            }
        }