Exemple #1
0
 private void EditResultsForm_Load(object sender, EventArgs e)
 {
     // Populate list of assignments
     PopulateList();
     // Assign the boxes their datasources
     assignmentsBox.DataSource  = AssignmentsList;
     studentsListBox.DataSource = StudentsList;
     // Add grades into the combobox
     foreach (KeyValuePair <string, double> grade in GradeUtils.Grades)
     {
         resultsComboBox.Items.Add(grade.Key);
     }
     // If assignment is provided, select the assignment that was just created.
     if (assignmentName != null)
     {
         assignmentId = GradeUtils.getAssignmentId(assignmentName, isHomework);
         assignmentsBox.SelectedItem = assignmentName;
     }
     else
     {
         try
         {
             // Encase in try to stop errors if there are no assignments
             assignmentId = GradeUtils.getAssignmentId((string)assignmentsBox.SelectedItem, isHomework);
         }
         catch (Exception)
         {
             // No assignment exists.
         }
     }
     if (!isHomework)
     {
         assignmentLabel.Text = "Test name:";
     }
 }
Exemple #2
0
 private void assignmentsBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     assignmentName = assignmentsBox.SelectedItem.ToString();
     assignmentId   = GradeUtils.getAssignmentId(assignmentName, isHomework);
 }