Ejemplo n.º 1
0
        private void Worker()
        {
            string failureCause = "";
            for (int i = 0; i < this.engineTacheList.Count; i++)
            {               
                this.currentTache = this.engineTacheList[i];

                this.TitleChanged(this.currentTache.Title);

                bool excuteSucceed = false;
                try
                {
                    excuteSucceed = this.currentTache.Excute(out failureCause);
                }
                catch(Exception ee)
                {
                    failureCause += string.Format("EngineTache({0}) Exception Message : {1}",this.currentTache.EngineTacheID , ee.Message); 
                }

                if (!excuteSucceed)
                {
                    if (this.hasNecceryEnder && (i != (this.engineTacheList.Count - 1)))
                    {
                        string cause = null;
                        this.currentTache = this.engineTacheList[this.engineTacheList.Count-1];
                        this.currentTache.Excute(out cause);
                    }
                    this.EngineDisruptted(failureCause);
                    return;
                }
            }           

            this.EngineCompleted();
        }