/// <summary> /// Loads a new question set and logs the start of the set. /// </summary> /// <param name="index">Index of Set</param> private void LoadQuestionSetAt(int index) { _currentQuestionSet = _questionSets[index]; var name = _currentQuestionSet.Name; name = name.Length > 15 ? name.Substring(0, 15) : name; _log.InsertLiveSystemEvent("QuestionnaireSystem", "Start Set", null, name); _currentQuestion = 0; _totalQuestions = _currentQuestionSet.Questions.Count; _questionNames = _currentQuestionSet.Questions.Select(question => question.Name).ToList(); }
public void WriteQuestionSetToXml(QuestionSet questionSet, string fileName) { var folderPath = Application.dataPath + "/Experiment/Resources/QuestionSets/" + fileName; var xmlSerializer = new XmlSerializer(typeof(QuestionSet)); using (var stream = new FileStream(folderPath, FileMode.Create)) { using (var sw = new StreamWriter(stream, Encoding.UTF8)) { xmlSerializer.Serialize(sw, questionSet); } } Debug.Log("Wrote settings to " + folderPath); }
public List <QuestionSet> ReadQuestionSetsFromDb(IEnumerable <Questionnaire> questionnaires) { var qSets = new List <QuestionSet>(); foreach (var questionnaire in questionnaires) { foreach (var t in questionnaire.QuestionSets) { var qSet = new QuestionSet(t); qSet.LoadFromDatabase(_log); qSets.Add(qSet); } } return(qSets); }