// save the batch and close the form private void saveButton_Click(object sender, EventArgs e) { for (int i = 0; i < 3; i++) { if (!TableArrayHandling.CheckAnswers(correctAnswers, i)) { MessageBox.Show(Properties.Resources.ErrorTextCorrectAnswersNotSelected, Properties.Resources.ErrorCaptionGeneral, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } if (answerSheetFilenames.Count == 0) { MessageBox.Show(Properties.Resources.ErrorTextNoAnswerSheetsSelected, Properties.Resources.ErrorCaptionGeneral, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } categoryBatch.CorrectAnswers = correctAnswers; categoryBatch.SheetFilenames = answerSheetFilenames; DialogResult = DialogResult.OK; this.Close(); }
private void applyButton_Click(object sender, EventArgs e) { if (addMode && (scanFilePath == null || scanFilePath == "")) { MessageBox.Show(Properties.Resources.ErrorTextNoFileSelected, Properties.Resources.ErrorCaptionGeneral, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!TableArrayHandling.CheckAnswers(expectedValuesStudentTableTemp, 0)) { MessageBox.Show(Properties.Resources.ErrorTextStudentNumberNotSelected, Properties.Resources.ErrorCaptionGeneral, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } for (int i = 0; i < 3; i++) { if (!TableArrayHandling.CheckAnswers(expectedValuesAnswerTableTemp, i)) { MessageBox.Show(Properties.Resources.ErrorTextExpectedAnswersNotSelected, Properties.Resources.ErrorCaptionGeneral, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } // apply the changes expectedValuesStudentTable = expectedValuesStudentTableTemp; expectedValuesAnswerTable = expectedValuesAnswerTableTemp; // draw the computed answers for comparison (if there are any) bool[,,] computedValuesStudentTable; bool[,,] computedValuesAnswerTable; List <KlokanTestDBComputedAnswer> computedValues = new List <KlokanTestDBComputedAnswer>(scanItem.ComputedValues); TableArrayHandling.DbSetToAnswers(computedValues, out computedValuesStudentTable, out computedValuesAnswerTable); FormTableHandling.DrawAnswers(studentTablePictureBox, computedValuesStudentTable, 0, FormTableHandling.DrawCircle, Color.Red); FormTableHandling.DrawAnswers(answerTable1PictureBox, computedValuesAnswerTable, 0, FormTableHandling.DrawCircle, Color.Red); FormTableHandling.DrawAnswers(answerTable2PictureBox, computedValuesAnswerTable, 1, FormTableHandling.DrawCircle, Color.Red); FormTableHandling.DrawAnswers(answerTable3PictureBox, computedValuesAnswerTable, 2, FormTableHandling.DrawCircle, Color.Red); updateButton.Enabled = true; editButton.Enabled = true; applyButton.Enabled = false; discardButton.Enabled = false; viewMode = true; }