private void ShowItems() { string[] items = GetItems(); bool lastItem = (items != null && items.Length == 1) && (selectionDepth == SelectionDepth.Schedules); if (lastItem) { selectedSectionIndex = 0; MoveSelection(1); items = GetItems(); } if (items == null || items.Length == 0 || selectionDepth == SelectionDepth.Schedule) { if (selectedSectionIndex != -1) { Schedule schedule = ClassScheduleDatabase.GetSchedule(selectedGrade, selectedSection, selectedSectionIndex); schedulePanel.Open(schedule); MoveSelection((lastItem ? -2 : -1)); } return; } ClearAll(); for (int i = 0; i < items.Length; i++) { ShowItem(i, items[i]); } }
private string[] GetItems() { switch (selectionDepth) { case SelectionDepth.Grades: return(ClassScheduleDatabase.GetGradeItems()); case SelectionDepth.Sections: return(ClassScheduleDatabase.GetSectionItems(selectedGrade)); case SelectionDepth.Schedules: return(ClassScheduleDatabase.GetScheduleItems(selectedGrade, selectedSection)); default: return(null); } }