Пример #1
0
        private void btnLevel2_Click(object sender, EventArgs e)
        {
            ReplacingLevel2Form l2 = new ReplacingLevel2Form();

            this.Hide();
            l2.ShowDialog();
            this.Close();
        }
Пример #2
0
        //checking to see if the user was correct
        private void btnCheck_Click(object sender, EventArgs e)
        {
            /*            //listbox items to list
             *          List<string> bookList = lbBooks.Items.OfType<string>().ToList();
             *
             *          //for loop for list
             *          for (int i = 0; i <bookList.Count; i++)
             *          {
             *
             *          }*/
            //listbox to list
            List <Book> bookList = lbBooks.Items.OfType <Book>().ToList();
            //get answer list
            List <Book> answers1 = LibraryManager.getBookAnswer1();

            //if the lists are equal
            if (bookList.SequenceEqual(answers1))
            {
                DialogResult dialogResult = MessageBox.Show("Well Done! Do you want to try Level 2?", "Congratulations", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    ReplacingLevel2Form l2 = new ReplacingLevel2Form();
                    this.Hide();
                    l2.ShowDialog();
                    this.Close();
                }
                else
                {
                    HomeForm home = new HomeForm();
                    this.Hide();
                    home.ShowDialog();
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("Try again", "Oh No", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }