Esempio n. 1
0
 private void answerBtn4_Click(object sender, EventArgs e)
 {
     if (answerBtn4.Text == rightAnswer)
     {
         MessageBox.Show("Верен отговор !");
         level++;
         FillQustionsAndAnswers();
     }
     else
     {
         MessageBox.Show("Грешен отговор !");
         endGame loadEnd = new endGame();
         loadEnd.ShowDialog();
     }
 }
Esempio n. 2
0
 private void answerBtn1_Click(object sender, EventArgs e)
 {
     if (answerBtn1.Text == rightAnswer)
     {
         MessageBox.Show("Верен отговор !");
         level++;
         FillQustionsAndAnswers();
         // пълни текста на бутоните. Същото се отнася и за другите клик бутони
     }
     else
     {
         MessageBox.Show("Грешен отговор !");
         endGame loadEnd = new endGame();
         loadEnd.ShowDialog();
         // препраща към формата за край на програмата. Същото се отнася и за другите клик бутони.
     }
 }
Esempio n. 3
0
        public void FillQustionsAndAnswers()

        {
            // пълни въпросите според нивата и прави избор на произволен въпрос от всяко ниво
            //Взима въпросите от файла
            scoreLbl.Text = "" + level;
            string dbFile;

            dbFile = Application.StartupPath;

            if (dbFile.Substring(dbFile.Length - 1) == "\\")
            {
                dbFile = dbFile.Remove(dbFile.Length - 1);
            }

            dbFile = dbFile + "\\dbFile.txt";
            StreamReader tr        = new StreamReader(dbFile, System.Text.Encoding.GetEncoding(0));
            string       textLines = "";

            while ((textLines = tr.ReadLine()) != null)
            {
                if (textLines[0] == '1')
                {
                    QuestionAnswer1.Add(textLines.Split('|'));
                }

                if (textLines[0] == '2')
                {
                    QuestionAnswer2.Add(textLines.Split('|'));
                }
                if (textLines[0] == '3')
                {
                    QuestionAnswer3.Add(textLines.Split('|'));
                }
                if (textLines[0] == '4')
                {
                    QuestionAnswer4.Add(textLines.Split('|'));
                }
                if (textLines[0] == '5')
                {
                    QuestionAnswer5.Add(textLines.Split('|'));
                }
            }
            if (level == 1)

            {
                fillAnswers(QuestionAnswer1);
            }
            if (level == 2)
            {
                fillAnswers(QuestionAnswer2);
            }
            if (level == 3)
            {
                fillAnswers(QuestionAnswer3);
            }
            if (level == 4)
            {
                fillAnswers(QuestionAnswer4);
            }
            if (level == 5)
            {
                fillAnswers(QuestionAnswer5);
            }
            if (level > 5)
            {
                endGame loadEnd = new endGame();
                loadEnd.ShowDialog();
            }
        }