/// <summary> /// Initializes a new instance of the <see cref="JobViewModel"/> class. /// </summary> /// <param name="model">The model.</param> public JobViewModel(Job model) { this.model = model; }
/// <summary> /// Initializes the job events. /// </summary> /// <param name="job">The job.</param> private void InitializeJobEvents(Job job) { job.CreatedDirectory += currentJob_CreatedDirectory; job.CreatedFile += currentJob_CreatedFile; job.CreatingDirectory += currentJob_CreatingDirectory; job.CreatingFile += currentJob_CreatingFile; job.DeletedDirectory += currentJob_DeletedDirectory; job.DeletedFile += currentJob_DeletedFile; job.DeletingDirectory += currentJob_DeletingDirectory; job.DeletingFile += currentJob_DeletingFile; job.DirectoryCreationError += currentJob_DirectoryCreationError; job.DirectoryDeletionError += currentJob_DirectoryDeletionError; job.FileCopyError += currentJob_FileCopyError; job.FileCopyProgressChanged += currentJob_FileCopyProgressChanged; job.FileDeletionError += currentJob_FileDeletionError; job.Finished += currentJob_Finished; job.ModifiedFile += currentJob_ModifiedFile; job.ModifyingFile += currentJob_ModifyingFile; job.ProceededFile += currentJob_ProceededFile; }
/// <summary> /// Initializes a new instance of the <see cref="JobEventArgs"/> class. /// </summary> /// <param name="job">The job.</param> public JobEventArgs(Job job) { job.ThrowIfNull(() => job); this.Job = job; }
/// <summary> /// Starts the next job, if the job queue is not empty, otherwise shuts down the job worker. /// </summary> private void DoNextJob() { if (this.jobQueue.Count > 0) { this.currentJob = this.jobQueue.Dequeue(); this.InitializeJobEvents(this.currentJob); this.JobStarted.RaiseSafe(this, new JobEventArgs(this.currentJob)); this.currentJob.Start(this.performPreview); } else { this.IsRunning = false; this.Finished.RaiseSafe(this, EventArgs.Empty); } }