private void AssignmentListBox_SelectedIndexChanged(object sender, EventArgs e) { activeAssignment = assignments[AssignmentListBox.SelectedIndex]; AssignmentIDLabel.Text = activeAssignment.Id(); AssignmentIDLabel.Update(); AssignmentIDLabel.Show(); AssignmentCourseLabel.Text = activeAssignment.Course_Id(); AssignmentCourseLabel.Show(); AssignmentDueLabel.Text = activeAssignment.Due_At(); AssignmentDueLabel.Show(); AssignmentGradingLabel.Text = activeAssignment.Grading_Type(); AssignmentGradingLabel.Show(); }
// Get the assignments available for this course public Assignment[] GetAssignments(string course_id) { HttpRequestMessage req = new HttpRequestMessage(HttpMethod.Get, String.Format(Properties.Resources.API_LIST_ASSIGNMENTS, course_id)); HttpResponseMessage resp = client.SendAsync(req).Result; JArray ass = JArray.Parse(resp.Content.ReadAsStringAsync().Result); Assignment[] assignments = new Assignment[ass.Count]; for (int i = 0; i < ass.Count; ++i) { assignments[i] = new Assignment((string)ass[i]["id"], (string)ass[i]["name"], (string)ass[i]["description"], (string)ass[i]["due_at"], (string)ass[i]["course_id"], (string)ass[i]["grading_type"]); } return assignments; }