Beispiel #1
0
        public QuestionForm(Question question = null)
        {
            InitializeComponent();
            answerListBox.DisplayMember = "Printout";
            this.question = question;

            if (this.question != null) {
                nameTextBox.Text = this.question.Name;

                requiredCheckBox.Checked = this.question.Required;

                colorButton.BackColor = this.question.ButtonColor;
                if (colorButton.BackColor.GetBrightness() < 0.5) colorButton.ForeColor = Color.White;
                else colorButton.ForeColor = Color.Black;

                if (this.question.Type == Question.QuestionType.SingleAnswer) singleRadioButton.Checked = true;
                else multipleRadioButton.Checked = true;

                foreach (Answer answer in question.Answers) {
                    answerListBox.Items.Add(answer);
                }
            } else this.question = new Question();
        }
Beispiel #2
0
 public Answer(string name, decimal cost, Question owner)
 {
     this.name = name;
     this.cost = cost;
     this.owner = owner;
 }