} // RecordTasksDialog_Shown private void AsyncBuildList(BackgroundWorkerOptions options, IBackgroundWorkerDialog dialog) { var result = options.OutputData as AsyncResult; if (dialog.QueryCancel()) { return; } dialog.SetProgressText(TasksTexts.ObtainingTasks); result.taskList = TaskList.Build(new TaskListBuildOptions() { RecordTaskFolder = RecordTaskFolder, SchedulerFolders = SchedulerFolders, ScanAllWindowsSchedulerTasks = true, AddAllWindowsSchedulerTaks = true, }); if (dialog.QueryCancel()) { return; } dialog.SetProgressText(TasksTexts.CreatingTasksList); var q = from task in result.taskList where task.Status == TaskStatus.Ok select task; var items = new List <ListViewItem>(result.taskList.Count); foreach (var task in q) { var channelName = (task.Task != null) ? task.Task.Channel.Name : null; var name = (task.Task != null) ? task.Name : task.SchedulerName; var item = new ListViewItem(channelName); item.SubItems.Add(name); if (task.Task == null) { item.SubItems.Add(TasksTexts.TaskNameUnknown); } else { item.SubItems.Add(ToString(task.Task.Schedule.Kind)); } // if-else item.SubItems.Add(task.NumberOfRecordings == null ? TasksTexts.RecordingsUnknown : task.NumberOfRecordings.Value.ToString(Application.CurrentCulture)); item.Tag = task; items.Add(item); } // foreach result.items = items.ToArray(); } // AsyncBuildList