private void CollectCheckedLTs() { for (int i = 0; i < learningTaskList.Items.Count; i++) { TypeListItem typeListItem = learningTaskList.Items[i] as TypeListItem; if (typeListItem == null) { continue; } Type ltType = typeListItem.Type; Type worldType = m_currentWorldType; // this is the value of last known world (it is not reflecting the real "current" at this place if (learningTaskList.GetItemCheckState(i) == CheckState.Checked) { ResultLearningTaskTypes.Add(new Tuple <Type, Type>(ltType, worldType)); } else { ResultLearningTaskTypes.Remove(new Tuple <Type, Type>(ltType, worldType)); } } }
private void PopulateLearningTaskList() { learningTaskList.Items.Clear(); Type selectedWorldType = (worldList.SelectedItem as TypeListItem).Type; List <Type> worldTasks = CurriculumManager.GetTasksForWorld(selectedWorldType); List <Type> checkedTasks = ResultLearningTaskTypes.Select(resultLearningTaskType => resultLearningTaskType.Item1).ToList(); AuthorizeCheck = true; for (int i = 0; i < worldTasks.Count; i++) { learningTaskList.Items.Add(new LearningTaskListItem(worldTasks[i])); learningTaskList.SetItemChecked(i, checkedTasks.Contains(worldTasks[i])); } AuthorizeCheck = false; if (learningTaskList.Items.Count > 0) { learningTaskList.SelectedIndex = 0; } }