Exemplo n.º 1
0
        private void btnEnter_Click(object sender, EventArgs e)
        {
            if (txtNaam.Text != " " && numericUpDown1.Value != 0 && rdbElf.Checked && rdbHero.Checked)
            {
                Warcraft hero = new Heroes(txtNaam.Text, numericUpDown1.Value.ToString(), rdbElf.Text.ToString(), txtSpec.Text);
                warcraft.Add(hero);
                List <Heroes> heroes = new List <Heroes>();

                foreach (var item in warcraft.OfType <Heroes>())
                {
                    heroes.Add(item);
                }
                listBoxNaam.DataSource = null;
                listBoxNaam.DataSource = heroes;
                MessageBox.Show($"New hero\n" +
                                $"Naam: {txtNaam.Text}\n" +
                                $"Level: {numericUpDown1.Value}\n" +
                                $"Type: {rdbElf.Text}\n" +
                                $"Specifiek: {txtSpec.Text}");
                txtNaam.Clear();
                txtSpec.Clear();
                numericUpDown1.Value = 0;
                rdbElf.Checked       = false;
                rdbHero.Checked      = false;
            }
            else if (txtNaam.Text != " " && numericUpDown1.Value != 0 && rdbHuman.Checked && rdbHero.Checked)
            {
                Warcraft hero = new Heroes(txtNaam.Text, numericUpDown1.Value.ToString(), rdbHuman.Text.ToString(), txtSpec.Text);
                warcraft.Add(hero);
                List <Heroes> heroes = new List <Heroes>();

                foreach (var item in warcraft.OfType <Heroes>())
                {
                    heroes.Add(item);
                }
                listBoxNaam.DataSource = null;
                listBoxNaam.DataSource = heroes;
                MessageBox.Show($"New hero\n" +
                                $"Naam: {txtNaam.Text}\n" +
                                $"Level: {numericUpDown1.Value}\n" +
                                $"Type: {rdbHuman.Text}\n" +
                                $"Specifiek: {txtSpec.Text}");
                txtNaam.Clear();
                txtSpec.Clear();
                numericUpDown1.Value = 0;
                rdbHuman.Checked     = false;
                rdbHero.Checked      = false;
            }
            else if (txtNaam.Text != " " && numericUpDown1.Value != 0 && rdbOrcs.Checked && rdbHero.Checked)
            {
                Warcraft hero = new Heroes(txtNaam.Text, numericUpDown1.Value.ToString(), rdbOrcs.Text.ToString(), txtSpec.Text);
                warcraft.Add(hero);
                List <Heroes> heroes = new List <Heroes>();

                foreach (var item in warcraft.OfType <Heroes>())
                {
                    heroes.Add(item);
                }
                listBoxNaam.DataSource = null;
                listBoxNaam.DataSource = heroes;
                MessageBox.Show($"New hero\n" +
                                $"Naam: {txtNaam.Text}\n" +
                                $"Level: {numericUpDown1.Value}\n" +
                                $"Type: {rdbOrcs.Text}\n" +
                                $"Specifiek: {txtSpec.Text}");
                txtNaam.Clear();
                txtSpec.Clear();
                numericUpDown1.Value = 0;
                rdbOrcs.Checked      = false;
                rdbHero.Checked      = false;
            }
            else if (txtNaam.Text != " " && numericUpDown1.Value != 0 && rdbUndead.Checked && rdbHero.Checked)
            {
                Warcraft hero = new Heroes(txtNaam.Text, numericUpDown1.Value.ToString(), rdbUndead.Text.ToString(), txtSpec.Text);
                warcraft.Add(hero);
                List <Heroes> heroes = new List <Heroes>();

                foreach (var item in warcraft.OfType <Heroes>())
                {
                    heroes.Add(item);
                }

                MessageBox.Show($"New hero\n" +
                                $"Naam: {txtNaam.Text}\n" +
                                $"Level: {numericUpDown1.Value}\n" +
                                $"Type: {rdbUndead.Text}\n" +
                                $"Specifiek: {txtSpec.Text}");
                txtNaam.Clear();
                txtSpec.Clear();
                numericUpDown1.Value = 0;
                rdbUndead.Checked    = false;
                rdbHero.Checked      = false;
            }
            else if (txtNaam.Text != " " && numericUpDown1.Value != 0 && rdbElf.Checked && rdbArcher.Checked)
            {
                Warcraft archer = new Archer(txtNaam.Text, numericUpDown1.Value.ToString(), rdbElf.Text.ToString(), txtSpec.Text);
                warcraft.Add(archer);
                List <Archer> archers = new List <Archer>();

                foreach (var item in warcraft.OfType <Archer>())
                {
                    archers.Add(item);
                }
                listBoxNaam.DataSource = null;
                listBoxNaam.DataSource = archers;
                MessageBox.Show($"New archer\n" +
                                $"Naam: {txtNaam.Text}\n" +
                                $"Level: {numericUpDown1.Value}\n" +
                                $"Type: {rdbElf.Text}\n" +
                                $"Specifiek: {txtSpec.Text}");
                txtNaam.Clear();
                txtSpec.Clear();
                numericUpDown1.Value = 0;
                rdbElf.Checked       = false;
                rdbArcher.Checked    = false;
            }
            else if (txtNaam.Text != " " && numericUpDown1.Value != 0 && rdbHuman.Checked && rdbArcher.Checked)
            {
                Warcraft archer = new Archer(txtNaam.Text, numericUpDown1.Value.ToString(), rdbHuman.Text.ToString(), txtSpec.Text);
                warcraft.Add(archer);
                List <Archer> archers = new List <Archer>();

                foreach (var item in warcraft.OfType <Archer>())
                {
                    archers.Add(item);
                }
                listBoxNaam.DataSource = null;
                listBoxNaam.DataSource = archers;
                MessageBox.Show($"New archer\n" +
                                $"Naam: {txtNaam.Text}\n" +
                                $"Level: {numericUpDown1.Value}\n" +
                                $"Type: {rdbHuman.Text}\n" +
                                $"Specifiek: {txtSpec.Text}");
                txtNaam.Clear();
                txtSpec.Clear();
                numericUpDown1.Value = 0;
                rdbHuman.Checked     = false;
                rdbArcher.Checked    = false;
            }
            else if (txtNaam.Text != " " && numericUpDown1.Value != 0 && rdbOrcs.Checked && rdbArcher.Checked)
            {
                Warcraft archer = new Archer(txtNaam.Text, numericUpDown1.Value.ToString(), rdbOrcs.Text.ToString(), txtSpec.Text);
                warcraft.Add(archer);
                List <Archer> archers = new List <Archer>();

                foreach (var item in warcraft.OfType <Archer>())
                {
                    archers.Add(item);
                }
                listBoxNaam.DataSource = null;
                listBoxNaam.DataSource = archers;
                MessageBox.Show($"New archer\n" +
                                $"Naam: {txtNaam.Text}\n" +
                                $"Level: {numericUpDown1.Value}\n" +
                                $"Type: {rdbOrcs.Text}\n" +
                                $"Specifiek: {txtSpec.Text}");
                txtNaam.Clear();
                txtSpec.Clear();
                numericUpDown1.Value = 0;
                rdbOrcs.Checked      = false;
                rdbArcher.Checked    = false;
            }
            else if (txtNaam.Text != " " && numericUpDown1.Value != 0 && rdbUndead.Checked && rdbArcher.Checked)
            {
                Warcraft archer = new Archer(txtNaam.Text, numericUpDown1.Value.ToString(), rdbUndead.Text.ToString(), txtSpec.Text);
                warcraft.Add(archer);
                List <Archer> archers = new List <Archer>();

                foreach (var item in warcraft.OfType <Archer>())
                {
                    archers.Add(item);
                }
                listBoxNaam.DataSource = null;
                listBoxNaam.DataSource = archers;
                MessageBox.Show($"New archer\n" +
                                $"Naam: {txtNaam.Text}\n" +
                                $"Level: {numericUpDown1.Value}\n" +
                                $"Type: {rdbUndead.Text}\n" +
                                $"Specifiek: {txtSpec.Text}");
                txtNaam.Clear();
                txtSpec.Clear();
                numericUpDown1.Value = 0;
                rdbUndead.Checked    = false;
                rdbArcher.Checked    = false;
            }
            else if (txtNaam.Text != " " && numericUpDown1.Value != 0 && rdbUndead.Checked && rdbHorseman.Checked)
            {
                Warcraft horseman = new Archer(txtNaam.Text, numericUpDown1.Value.ToString(), rdbUndead.Text.ToString(), txtSpec.Text);
                warcraft.Add(horseman);
                List <Archer> horsemen = new List <Archer>();

                foreach (var item in warcraft.OfType <Archer>())
                {
                    horsemen.Add(item);
                }
                listBoxNaam.DataSource = null;
                listBoxNaam.DataSource = horsemen;
                MessageBox.Show($"New horseman\n" +
                                $"Naam: {txtNaam.Text}\n" +
                                $"Level: {numericUpDown1.Value}\n" +
                                $"Type: {rdbUndead.Text}\n" +
                                $"Specifiek: {txtSpec.Text}");
                txtNaam.Clear();
                txtSpec.Clear();
                numericUpDown1.Value = 0;
                rdbUndead.Checked    = false;
                rdbHorseman.Checked  = false;
            }
            else if (txtNaam.Text != " " && numericUpDown1.Value != 0 && rdbOrcs.Checked && rdbHorseman.Checked)
            {
                Warcraft horseman = new Archer(txtNaam.Text, numericUpDown1.Value.ToString(), rdbOrcs.Text.ToString(), txtSpec.Text);
                warcraft.Add(horseman);
                List <Archer> horsemen = new List <Archer>();

                foreach (var item in warcraft.OfType <Archer>())
                {
                    horsemen.Add(item);
                }
                listBoxNaam.DataSource = null;
                listBoxNaam.DataSource = horsemen;
                MessageBox.Show($"New horseman\n" +
                                $"Naam: {txtNaam.Text}\n" +
                                $"Level: {numericUpDown1.Value}\n" +
                                $"Type: {rdbOrcs.Text}\n" +
                                $"Specifiek: {txtSpec.Text}");
                txtNaam.Clear();
                txtSpec.Clear();
                numericUpDown1.Value = 0;
                rdbOrcs.Checked      = false;
                rdbHorseman.Checked  = false;
            }
            else if (txtNaam.Text != " " && numericUpDown1.Value != 0 && rdbElf.Checked && rdbHorseman.Checked)
            {
                Warcraft horseman = new Archer(txtNaam.Text, numericUpDown1.Value.ToString(), rdbElf.Text.ToString(), txtSpec.Text);
                warcraft.Add(horseman);
                List <Archer> horsemen = new List <Archer>();

                foreach (var item in warcraft.OfType <Archer>())
                {
                    horsemen.Add(item);
                }
                listBoxNaam.DataSource = null;
                listBoxNaam.DataSource = horsemen;
                MessageBox.Show($"New horseman\n" +
                                $"Naam: {txtNaam.Text}\n" +
                                $"Level: {numericUpDown1.Value}\n" +
                                $"Type: {rdbElf.Text}\n" +
                                $"Specifiek: {txtSpec.Text}");
                txtNaam.Clear();
                txtSpec.Clear();
                numericUpDown1.Value = 0;
                rdbElf.Checked       = false;
                rdbHorseman.Checked  = false;
            }
            else if (txtNaam.Text != " " && numericUpDown1.Value != 0 && rdbHuman.Checked && rdbHorseman.Checked)
            {
                Warcraft horseman = new Archer(txtNaam.Text, numericUpDown1.Value.ToString(), rdbHuman.Text.ToString(), txtSpec.Text);
                warcraft.Add(horseman);
                List <Archer> horsemen = new List <Archer>();

                foreach (var item in warcraft.OfType <Archer>())
                {
                    horsemen.Add(item);
                }
                listBoxNaam.DataSource = null;
                listBoxNaam.DataSource = horsemen;
                MessageBox.Show($"New horseman\n" +
                                $"Naam: {txtNaam.Text}\n" +
                                $"Level: {numericUpDown1.Value}\n" +
                                $"Type: {rdbHuman.Text}\n" +
                                $"Specifiek: {txtSpec.Text}");
                txtNaam.Clear();
                txtSpec.Clear();
                numericUpDown1.Value = 0;
                rdbHuman.Checked     = false;
                rdbHorseman.Checked  = false;
            }
            else
            {
                MessageBox.Show("Vuil alles in aub.");
            }
        }