public Exam GetExam() { if (openedExam != null) { return(openedExam); } Exam exam; try { ExamFileService fileService = ExamFileService.GetInstance(); exam = fileService.OpenExam(filePath, password); password = exam.Password; SaverName = exam.Name; } catch (Exception ex) { LastExceptionMessage = ex.Message; exam = null; } openedExam = exam; return(exam); }
public IList <Question> GetQuestions() { List <Question> result; if (openedExam != null) { result = new List <Question>(); for (int i = 0; i < openedExam.Tickets.Count; i++) { result.AddRange(openedExam.Tickets[i].GetQuestions()); } return(result); } Exam exam; try { result = new List <Question>(); ExamFileService fileService = ExamFileService.GetInstance(); exam = fileService.OpenExam(filePath, password); password = exam.Password; SaverName = exam.Name; openedExam = exam; for (int i = 0; i < openedExam.Tickets.Count; i++) { result.AddRange(openedExam.Tickets[i].GetQuestions()); } } catch (Exception ex) { LastExceptionMessage = ex.Message; result = null; exam = null; } openedExam = exam; return(result); }