예제 #1
0
        private void btnCheck_Click(object sender, EventArgs e)
        {
            //listbox to list
            List <Book> bookList = lbBooks.Items.OfType <Book>().ToList();
            //get answer list
            List <Book> answers2 = LibraryManager.getBookAnswer2();

            //if the lists are equal
            if (bookList.SequenceEqual(answers2))
            {
                DialogResult dialogResult = MessageBox.Show("Well Done! Do you want to try Level 2?", "Congratulations", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    ReplacingLevel3Form l3 = new ReplacingLevel3Form();
                    this.Hide();
                    l3.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);
            }
        }
예제 #2
0
        //go back to previous page
        private void btnBack_Click(object sender, EventArgs e)
        {
            HomeForm home = new HomeForm();

            this.Hide();
            home.ShowDialog();
            this.Close();
        }
예제 #3
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);
            }
        }