/// <summary> /// Enqueues the specified job. /// </summary> /// <param name="job">Job.</param> public CM_JobQueue Enqueue(CM_Job job) { job.NotifyOnJobComplete(HandlejobComplete); AddJobToQueue(job); if (_continousRunning && _jobQueue.Count == 1) { _jobQueue.Peek().Start(); } return(this); }
protected virtual CM_Job MakeJob(string id, IEnumerator routine, bool addListenerToOnComplete = true) { var job = CM_Job.Make(routine); job.id = (id.IsNullOrEmpty()) ? uniqueGeneratedID : id; if (addListenerToOnComplete) { job.NotifyOnJobComplete(HandlejobComplete); } return(job); }
/// <summary> /// Adds a job to the job manager. /// </summary> /// <returns>The job.</returns> /// <param name="job">Job.</param> public CM_JobManager AddJob(CM_Job job) { if (job.id.IsNullOrEmpty()) { AutoGenerateJobId(job); } if (!_ownedJobs.ContainsKey(job.id)) { _ownedJobs.Add(job.id, job); OnJobAdded(new CM_JobManagerJobEditedEventArgs(_ownedJobs, job)); } return(this); }
protected void AutoGenerateJobId(CM_Job job) { job.id = uniqueGeneratedID; }
protected virtual CM_Job MakeJob(CM_Job job) { job.NotifyOnJobComplete(HandlejobComplete); return(job); }
/// <summary> /// Determines whether the specified job is executing. /// </summary> /// <returns><c>true</c> if the job is currently running; otherwise, <c>false</c>.</returns> /// <param name="job">Job.</param> public bool IsRunning(CM_Job job) { return(IsRunning(job.id)); }
/// <summary> /// Resumes the specified coroutine if owned by this instance of job manager. Job is searched using job id. /// </summary> /// <returns>The job manager.</returns> /// <param name="job">Job.</param> public CM_JobManager ResumeCoroutine(CM_Job job) { ResumeCoroutine(job.id); return(this); }
/// <summary> /// Pauses the specified coroutine if owned by this instance of job manager. Job is searched using job id. /// </summary> /// <returns>The job manager.</returns> /// <param name="job">Job.</param> public CM_JobManager PauseCoroutine(CM_Job job) { PauseCoroutine(job.id); return(this); }
/// <summary> /// Stops the specified coroutine if owned by this instance of job manager. Job is searched using job id. /// </summary> /// <returns>The job manager.</returns> /// <param name="job">Job.</param> public CM_JobManager StopCoroutine(CM_Job job) { StopCoroutine(job.id); return(this); }
/// <summary> /// Removes the job if owned by this instance of job manager. /// </summary> /// <returns>The job manager.</returns> /// <param name="job">Job.</param> public CM_JobManager RemoveJob(CM_Job job) { return(RemoveJob(job.id)); }
private void RemoveJobFromQueue(CM_Job job) { job.RemoveNotifyOnJobComplete(HandlejobComplete); _completedJobs.Add(job); _jobQueue.Dequeue(); }
private void AddJobToQueue(CM_Job job) { _jobQueue.Enqueue(job); }
/// <summary> /// Initializes a new instance of the <see cref="CM_JobManagerJobEditedEventArgs"/> class. /// </summary> /// <param name="ownedJobs">Owned jobs.</param> /// <param name="jobEdited">Job edited.</param> public CM_JobManagerJobEditedEventArgs(Dictionary <string, CM_Job> ownedJobs, CM_Job jobEdited) { this.otherArgs = new CM_JobManagerEventArgs(ownedJobs); this.jobEdited = jobEdited; }