Esempio n. 1
0
File: View.cs Progetto: Trallex/Quiz
 private void Edit()
 {
     if (ProperQuestion())
     {
         ThisQuiz.EditItem(listBoxQuestions.SelectedIndex, CreateObject());
         Clear();
     }
 }
Esempio n. 2
0
File: View.cs Progetto: Trallex/Quiz
 private void Add()
 {
     if (ProperQuestion())
     {
         ThisQuiz.Record(CreateObject());
         listBoxQuestions.Items.Add((listBoxQuestions.Items.Count + 1).ToString());
         Clear();
     }
 }
Esempio n. 3
0
File: View.cs Progetto: Trallex/Quiz
        private void Delete()
        {
            ThisQuiz.RemoveItem(listBoxQuestions.SelectedIndex);

            for (int i = listBoxQuestions.SelectedIndex; i < listBoxQuestions.Items.Count - 1; i++)
            {
                listBoxQuestions.Items[i + 1] = (i + 1).ToString();
            }
            listBoxQuestions.Items.RemoveAt(listBoxQuestions.SelectedIndex);
        }
Esempio n. 4
0
File: View.cs Progetto: Trallex/Quiz
        private void listBoxQuestions_DoubleClick(object sender, EventArgs e)
        {
            Question temp = ThisQuiz.Load(listBoxQuestions.SelectedIndex);

            if (temp != null)
            {
                textBoxQuestion.Text = temp.questionText;
                AnswerLoad(answer1, temp.properAnswers[0], temp.answers[0]);
                AnswerLoad(answer2, temp.properAnswers[1], temp.answers[1]);
                AnswerLoad(answer3, temp.properAnswers[2], temp.answers[2]);
                AnswerLoad(answer4, temp.properAnswers[3], temp.answers[3]);
            }
        }
Esempio n. 5
0
File: View.cs Progetto: Trallex/Quiz
 private void SaveToXML()
 {
     if (ProperFileName())
     {
         SaveXML.SaveData(ThisQuiz.Value(), @".\" + textBoxName.Text + ".xml");
         ThisQuiz.ClearThemAll();
         listBoxQuestions.Items.Clear();
         errorProviderFName.Clear();
     }
     else
     {
         errorProviderFName.SetError(labelQName, "Give proper filename!");
     }
 }