示例#1
0
文件: View.cs 项目: Trallex/Quiz
 private void Edit()
 {
     if (ProperQuestion())
     {
         ThisQuiz.EditItem(listBoxQuestions.SelectedIndex, CreateObject());
         Clear();
     }
 }
示例#2
0
文件: View.cs 项目: Trallex/Quiz
 private void Add()
 {
     if (ProperQuestion())
     {
         ThisQuiz.Record(CreateObject());
         listBoxQuestions.Items.Add((listBoxQuestions.Items.Count + 1).ToString());
         Clear();
     }
 }
示例#3
0
文件: View.cs 项目: 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);
        }
示例#4
0
文件: View.cs 项目: 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]);
            }
        }
示例#5
0
文件: View.cs 项目: 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!");
     }
 }