예제 #1
0
파일: CM_Job.cs 프로젝트: yazici/bounce
 /// <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);
     }
 }
예제 #2
0
파일: CM_Job.cs 프로젝트: yazici/bounce
 /// <summary>
 /// Raises the job resumed event.
 /// </summary>
 /// <param name="e">E.</param>
 protected void OnJobResumed(CM_JobEventArgs e)
 {
     if (jobResumed != null)
     {
         jobResumed(this, e);
     }
 }
예제 #3
0
파일: CM_Job.cs 프로젝트: yazici/bounce
 /// <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);
     }
 }
예제 #4
0
파일: CM_Job.cs 프로젝트: yazici/bounce
 /// <summary>
 /// Raises the job complete event.
 /// </summary>
 /// <param name="e">E.</param>
 protected void OnJobComplete(CM_JobEventArgs e)
 {
     if (jobComplete != null)
     {
         jobComplete(this, e);
     }
 }
예제 #5
0
파일: CM_Job.cs 프로젝트: yazici/bounce
 /// <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);
     }
 }
예제 #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();
            }
        }
예제 #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);
            }
        }
예제 #8
0
파일: CM_Job.cs 프로젝트: yazici/bounce
        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);
            }
        }
예제 #9
0
 protected abstract void HandlejobComplete(object sender, CM_JobEventArgs e);