示例#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);