public Examinee(AssessmentScript script, string path) { InitializeComponent(); filePath = path; buttonSubmitAssessment.UseCompatibleTextRendering = true; StartPosition = FormStartPosition.CenterScreen; Script = script; NotifyAssessmentOpened(); }
public static AssessmentScript BuildForPublishing(Assessment assessment, StudentData data, AssessmentInformation info) { AssessmentScript script = BuildFromAssessment(assessment); //Set the data script.studentData = data; script.AssessmentInfo = info; script.timeData = data.GenerateTimeData(); script.published = true; return(script); }
private void DisplayInformation(AssessmentScript a) { //Show the assessment info. This will always be present if (a.AssessmentInfo != null) { AssessmentInformation ai = a.AssessmentInfo; if (!ai.AssessmentName.NullOrEmpty()) { lblAssessmentName.Text = ai.AssessmentName; } else { lblAssessmentName.Text = "Assessment"; } if (!ai.Author.NullOrEmpty()) { lblAuthor.Text = $"Author: {ai.Author}"; } else { lblAuthor.Text = ""; } lblWeighting.Text = ai.AssessmentWeighting > 0 ? $"{ai.AssessmentWeighting}%" : ""; } //Show the course info. This will only be present if the assessment has been published. if (a.CourseInformation != null) { CourseInformation c = a.CourseInformation; if (!c.CourseCodeFull.NullOrEmpty()) { lblCourseCode.Text = c.CourseCodeFull; } else { lblCourseCode.Text = ""; } if (!c.CourseName.NullOrEmpty()) { lblCourseName.Text = c.CourseName; } else { lblCourseName.Text = "Unkown course"; } } //Enable the information panel pnlInformation.Enabled = true; pnlInformation.Visible = true; }
public static void PopulateTreeView(TreeView treeView, AssessmentScript script) { treeView.Nodes.Clear(); List <QuestionNode> nodeList = new List <QuestionNode>(); foreach (var q in script.Questions) { nodeList.Add(BuildQuestionNodeRecursive(q)); } treeView.Nodes.AddRange(nodeList.ToArray()); }
public void OpenFromFile(string path) { if (File.Exists(path)) { string ext = Path.GetExtension(path); if (ext == ASSESSMENT_EXT) { try { using (FileStream s = File.Open(path, FileMode.Open)) { BinaryFormatter f = new BinaryFormatter(); Assessment assessment = (Assessment)f.Deserialize(s); script = AssessmentScript.BuildFromAssessment(assessment); string scriptPath = Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path) + ASSESSMENT_SCRIPT_EXT); NotifyAssessmentScriptOpened(scriptPath); } } catch (Exception ex) { MessageBox.Show("Unable to load file " + path + "\n\n" + ex.Message); } } else if (ext == ASSESSMENT_SCRIPT_EXT) { try { using (FileStream s = File.Open(path, FileMode.Open)) { BinaryFormatter formatter = new BinaryFormatter(); script = (AssessmentScript)formatter.Deserialize(s); NotifyAssessmentScriptOpened(path); } } catch (Exception ex) { MessageBox.Show("Unable to load file " + path + "\n\n" + ex.Message); } } else { MessageBox.Show("Unable to open file: " + path + "\n\n File has incorrect extension."); } } }
public void GetAutoMarkingQuestions(AssessmentScript script, Dictionary <MarkingQuestion, Question> dict) { Question q = script.FindQuestion(QuestionName); if (q != null) { if (q.AnswerType == AnswerType.Multi || q.AnswerType == AnswerType.Single) { dict.Add(this, q); } } if (HasSubQuestions) { foreach (var smq in SubMarkingQuestions) { smq.GetAutoMarkingQuestions(script, dict); } } }
public static AssessmentScript BuildFromAssessment(Assessment assessment) { AssessmentScript script = new AssessmentScript(); script.questions = assessment.Questions; script.published = false; //Populate answers dictionary with answer objects for each question foreach (var q in script.Questions) { q.AddToAnswerDict(script.Answers); } script.timeData = new TimeData() { Minutes = 60 }; script.AssessmentInfo = new AssessmentInformation() { AssessmentName = "Assessment", Author = "", AssessmentWeighting = 0 }; return(script); }
public AssessmentScriptListItem(AssessmentScript script, string name) { this.script = script; this.name = name; }