Ejemplo n.º 1
0
        private async Task Refresh()
        {
            _rootJobs = null;
            _jobs     = null;
            IsBusy    = true;

            await Task.Run(() => {
                _jobManager.BuildJobTree();
                _jobs     = _jobManager.AllJobs.Select(job => new JobObjectViewModel(job)).ToDictionary(job => job.Job.Address);
                _rootJobs = _jobs.Values.Where(job => job.ParentJob == null).ToList();
                foreach (var job in _jobs.Values.Where(job => job.Job.ChildJobs != null))
                {
                    job.ChildJobs = job.Job.ChildJobs.Select(child => _jobs[child.Address]).ToList();
                }
            });

            RaisePropertyChanged(nameof(RootJobs));
            RaisePropertyChanged(nameof(ActiveProcessesInJob));
            RaisePropertyChanged(nameof(JobList));
            IsBusy      = false;
            SelectedJob = null;
        }