Exemplo n.º 1
0
 /// <summary>
 /// Raises the child jobs complete event.
 /// </summary>
 /// <param name="e">E.</param>
 protected void OnChildJobsComplete(CM_JobEventArgs e)
 {
     if (childJobsComplete != null)
     {
         childJobsComplete(this, e);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Raises the job resumed event.
 /// </summary>
 /// <param name="e">E.</param>
 protected void OnJobResumed(CM_JobEventArgs e)
 {
     if (jobResumed != null)
     {
         jobResumed(this, e);
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Raises the child jobs started event.
 /// </summary>
 /// <param name="e">E.</param>
 protected void OnChildJobsStarted(CM_JobEventArgs e)
 {
     if (childJobsStarted != null)
     {
         childJobsStarted(this, e);
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Raises the job complete event.
 /// </summary>
 /// <param name="e">E.</param>
 protected void OnJobComplete(CM_JobEventArgs e)
 {
     if (jobComplete != null)
     {
         jobComplete(this, e);
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// Raises the job finished running event.
 /// </summary>
 /// <param name="e">E.</param>
 protected void OnJobFinishedRunning(CM_JobEventArgs e)
 {
     if (jobFinishedRunning != null)
     {
         jobFinishedRunning(this, e);
     }
 }
Exemplo n.º 6
0
        /// <summary>
        /// Invoked whenever a queued job has finished processing. Handles maintenance of queue and raising
        /// OnJobProcessed and OnQueueComplete events.
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="e">E.</param>
        protected override void HandlejobComplete(object sender, CM_JobEventArgs e)
        {
            if (e.job.repeating)
            {
                return;
            }

            RemoveJobFromQueue(e.job);

            var jobQueue      = _jobQueue.ToArray();
            var completedJobs = _completedJobs.ToArray();

            OnJobProcessed(new CM_QueueEventArgs(jobQueue, completedJobs, this));


            if (_jobQueue.Count > 0 && _jobQueueRunning)
            {
                _jobQueue.Peek().Start();
            }
            else if (_jobQueue.Count == 0 && _jobQueueRunning)
            {
                numOfTimesExecuted++;

                OnQueueComplete(new CM_QueueEventArgs(jobQueue, completedJobs, this));

                if (repeating)
                {
                    if (!_numOfTimesToRepeat.HasValue)
                    {
                        RequeueAll();
                        _jobQueue.Peek().Start();
                    }
                    else
                    {
                        if (numOfTimesExecuted < _numOfTimesToRepeat)
                        {
                            RequeueAll();
                            _jobQueue.Peek().Start();
                        }
                        else
                        {
                            repeating           = false;
                            _numOfTimesToRepeat = null;
                            _jobQueueRunning    = false;
                        }
                    }
                }
                else if (!_continousRunning)
                {
                    _jobQueueRunning = false;
                }

                _completedJobs.Clear();
            }
        }
Exemplo n.º 7
0
        protected override void HandlejobComplete(object sender, CM_JobEventArgs e)
        {
            if (e.job.repeating)
            {
                return;
            }

            e.job.RemoveNotifyOnJobComplete(HandlejobComplete);


            if (_ownedJobs.ContainsKey(e.job.id))
            {
                _ownedJobs.Remove(e.job.id);
            }
        }
Exemplo n.º 8
0
        private IEnumerator RunChildJobs()
        {
            if (_childJobs != null && _childJobs.Count > 0)
            {
                var eventArgs = new CM_JobEventArgs(this, _childJobs.ToArray());

                OnChildJobsStarted(eventArgs);

                foreach (var job in _childJobs)
                {
                    yield return(CM_Dispatcher.instance.StartCoroutine(job.StartAsCoroutine()));
                }

                OnChildJobsComplete(eventArgs);
            }
        }
Exemplo n.º 9
0
 protected abstract void HandlejobComplete(object sender, CM_JobEventArgs e);