예제 #1
0
        // List the courses available to this account
        public Course[] ListCourses()
        {
            HttpRequestMessage req = new HttpRequestMessage(HttpMethod.Get,
                Properties.Resources.API_LIST_COURSES);
            HttpResponseMessage resp = client.SendAsync(req).Result;
            JArray courses = JArray.Parse(resp.Content.ReadAsStringAsync().Result);
            Course[] courses_array = new Course[courses.Count];
            for (int i = 0; i < courses.Count; ++i)
            {
                Course c = new Course((string)courses[i]["name"],
                                      (string)courses[i]["id"]);
                courses_array[i] = c;
            }

            return courses_array;
        }
예제 #2
0
 private void CoursesListBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     HideEverything();
     activeCourse = courses[CoursesListBox.SelectedIndex];
     UpdateCourseInfo(sender, e);
 }