/// <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); } }
/// <summary> /// Raises the job resumed event. /// </summary> /// <param name="e">E.</param> protected void OnJobResumed(CM_JobEventArgs e) { if (jobResumed != null) { jobResumed(this, e); } }
/// <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); } }
/// <summary> /// Raises the job complete event. /// </summary> /// <param name="e">E.</param> protected void OnJobComplete(CM_JobEventArgs e) { if (jobComplete != null) { jobComplete(this, e); } }
/// <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); } }
/// <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(); } }
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); } }
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); } }
protected abstract void HandlejobComplete(object sender, CM_JobEventArgs e);