Esempio n. 1
0
        public void RunJob(bool stepping = false)
        {
            this.PrepareStepping(stepping);

            this._abortRequested = false;

            this.OnStartRun(new StartRunEventArgs(this._resetEvent));

            try
            {
                this.CurrentAction = this.Job.Actions.First();
            }
            catch (InvalidOperationException)
            {
                this.OnActionErrorOccurred(new ActionErrorEventArgs
                {
                    Action    = this.CurrentAction,
                    Exception = new FatalActionException(Resources.Program_RunJob_No_Actions_Added)
                });
            }

            Boolean jobFailed = false;

            try
            {
                while (this.CurrentAction != null)
                {
                    this.ShouldPauseStepping();

                    ContinueState continueState = this.RunStep(this.CurrentAction);

                    if (this.NeedsRetry(continueState))
                    {
                        continue;
                    }

                    this.ResetSteppingPause();

                    lock (this._abortRequested)
                    {
                        if ((bool)this._abortRequested)
                        {
                            throw new AbortOperationException();
                        }
                    }
                }
            }

            catch (AbortOperationException)
            {
                jobFailed = true;
            }
            this.OnJobCompleted(!jobFailed);
            this.FinishedStepping();
        }
Esempio n. 2
0
        private bool NeedsRetry(ContinueState continueState)
        {
            switch (continueState)
            {
            case ContinueState.Abort:
                throw new AbortOperationException();

            case ContinueState.Retry:
                return(true);

            default:
                this.CurrentAction = this.CurrentAction.GetNext();
                return(false);
            }
        }
Esempio n. 3
0
 void Awake()
 {
     instance = this;
 }