private void HandleJobStarted(object sender, JobStartedEventArgs args) { if (this.ActiveJob != null && this.ActiveJob.Job == args.Job) { return; } SyncJob syncJob = args.Job as SyncJob; if (syncJob != null) { this.ActiveJob = new SyncJobViewModel(syncJob, this, false); } AnalyzeJob analyzeJob = args.Job as AnalyzeJob; if (analyzeJob != null) { this.ActiveJob = new AnalyzeJobViewModel(analyzeJob, this); } RestoreJob restoreJob = args.Job as RestoreJob; if (restoreJob != null) { this.ActiveJob = new RestoreJobViewModel(restoreJob, this, false); } this.UpdateStatusDescription(); }
public async Task Raise_JobStarted() { using (var manager = new TaskManager(1)) { JobStartedEventArgs jobStartedEventArgs = null; manager.JobStarted += (sender, e) => jobStartedEventArgs = e; var job = Mock.Of <IJob>(); manager.Add(job, JobPriority.High); await manager.StartAsync(); await Task.Delay(100); await manager.StopAsync(); Assert.NotNull(jobStartedEventArgs); Assert.Equal(JobPriority.High, jobStartedEventArgs.Priority); Assert.Equal(job, jobStartedEventArgs.Job); } }
protected virtual void OnJobStarted(JobStartedEventArgs <CachedLog> e) { JobStarted?.Invoke(this, e); }