Ejemplo n.º 1
0
 public void OnViewFrameTime(float dt)
 {
     if (this.currentTask == null)
     {
         if (this.tasks.Count == 0)
         {
             if (this.completeCallback != null)
             {
                 this.completeCallback();
             }
             Service.ViewTimeEngine.UnregisterFrameTimeObserver(this);
         }
         else
         {
             this.currentTask = this.tasks.Dequeue();
             float endPercentage = (this.tasks.Count != 0) ? this.tasks.Peek().Percentage : 100f;
             this.currentTask.EndPercentage = endPercentage;
             this.currentTaskCompleted      = false;
             this.currentTask.Start();
             if (this.allStartsMustComplete && !this.currentTaskCompleted)
             {
                 Service.Logger.Error(this.currentTask.GetType().Name + " must call Complete() from its Start()");
             }
         }
     }
     if (this.progressCallback != null && this.currentTask != null)
     {
         this.progressCallback(this.currentTask.Percentage, this.currentTask.Description);
     }
 }
Ejemplo n.º 2
0
 public void OnViewFrameTime(float dt)
 {
     if (this.currentTask == null)
     {
         if (this.tasks.Count == 0)
         {
             if (this.completeCallback != null)
             {
                 this.completeCallback();
             }
             Service.Get <ViewTimeEngine>().UnregisterFrameTimeObserver(this);
         }
         else
         {
             this.currentTask = this.tasks.Dequeue();
             float endPercentage = (this.tasks.Count == 0) ? 100f : this.tasks.Peek().Percentage;
             this.currentTask.EndPercentage = endPercentage;
             this.currentTaskCompleted      = false;
             this.currentTask.Start();
         }
     }
     if (this.progressCallback != null && this.currentTask != null)
     {
         this.progressCallback(this.currentTask.Percentage, this.currentTask.Description);
     }
 }
Ejemplo n.º 3
0
 public StartupTaskController(StartupTaskProgress progressCallback, StartupTaskComplete completeCallback)
 {
     this.progressCallback      = progressCallback;
     this.completeCallback      = completeCallback;
     this.tasks                 = new Queue <StartupTask>();
     this.currentTask           = null;
     this.allStartsMustComplete = false;
     this.currentTaskCompleted  = false;
 }
Ejemplo n.º 4
0
 public void AddTask(StartupTask task)
 {
     task.Startup = this;
     if (this.tasks.Count == 0)
     {
         Service.ViewTimeEngine.RegisterFrameTimeObserver(this);
     }
     if (task != null)
     {
         this.tasks.Enqueue(task);
     }
 }
Ejemplo n.º 5
0
 public void OnTaskComplete(StartupTask task)
 {
     if (task == this.currentTask)
     {
         this.currentTaskCompleted = true;
         if (this.progressCallback != null)
         {
             this.progressCallback(this.currentTask.EndPercentage, this.currentTask.Description);
         }
         task.Startup     = null;
         this.currentTask = null;
     }
 }