//--------------------------------------------------------------------------------------------------------------------------------------------------- // // Copyright (C)2007 DarkWynter Studios. All rights reserved. // //--------------------------------------------------------------------------------------------------------------------------------------------------- // {Contact : darkwynter.com for licensing information //--------------------------------------------------------------------------------------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Text; using System.ComponentModel; using System.Data; using System.Drawing; using System.Windows.Forms; using System.Xml; using DarkWynter.Engine.Globals; using DarkWynter.Engine.Utilities; using Microsoft.Xna.Framework; namespace DarkWynter.App.Surveys { public class Question { // Survey Question/Problem proposed to user public string problem = ""; RadioButton answerButton; // Multiple-choice answers public List answers = new List(); public Question(XmlNode node) { // Load Problem statement and Answers // answers = new List(); for (int i = 0; i < node.ChildNodes.Count; i++) { if (node.ChildNodes[i].Name == "Problem") { problem = node.ChildNodes[i].Attributes["text"].Value; } if (node.ChildNodes[i].Name == "Answer") { answerButton = new RadioButton(); // answerButton.Text = node.ChildNodes[i].Attributes["text"].Value; answerButton.AutoSize = true; answerButton.Name = "radioButton" + i; answerButton.Location = new System.Drawing.Point(5, 5 + i*26); answerButton.Size = new System.Drawing.Size(113, 20); answerButton.TabIndex = 0; answerButton.TabStop = true; answerButton.Text = node.ChildNodes[i].Attributes["text"].Value; answerButton.Font = new Font("Microsoft Sans Serif", 11.0f, FontStyle.Regular); answerButton.UseVisualStyleBackColor = true; answers.Add(answerButton); } } } /// /// Load /// public void Load(SurveyForm surveyForm) { surveyForm.radioButtonGB.Controls.Clear(); for (int x = 0; x < answers.Count; x++) { surveyForm.radioButtonGB.Controls.Add(answers[x]); } } public void Save() { for (int x = 0; x < answers.Count; x++) { if (answers[x].Checked) { Logging.G2LSurveyLog.Add(DateTime.Now.ToString()+ " The answer selected was - " + answers[x].Text); Logging.G2LSurveyLog.Add(" "); } } } } }