private void button2AddMullusk_Click(object sender, EventArgs e) { var mf = new MulluskForm(); using (mf) { if (mf.ShowDialog() == DialogResult.OK) { if (mf.octopus != null) { MyTimer.Enabled = false; currentAquarium.AllAnimalsCollection.Add(mf.octopus); currentAquarium.MolluskCollection.Add(mf.octopus); var aw = new AnimalWrapper(mf.octopus); // aw.picBox.Name = mf.octopus.AnimalName; animals.Add(aw); this.Controls.Add(aw.picBox); this.Controls.Add(aw.labelName); textBox2MolluskNumber.Text = currentAquarium.MolluskCollection.Count().ToString(); MessageBox.Show("You successfully added a new octopus", "Happy little octopus", MessageBoxButtons.OK, MessageBoxIcon.Information); MyTimer.Enabled = true; } } if (mf.starFish != null) { MyTimer.Enabled = false; currentAquarium.AllAnimalsCollection.Add(mf.starFish); currentAquarium.MolluskCollection.Add(mf.starFish); var aw = new AnimalWrapper(mf.starFish); animals.Add(aw); this.Controls.Add(aw.picBox); textBox2MolluskNumber.Text = currentAquarium.MolluskCollection.Count().ToString(); MessageBox.Show("You successfully added a new starfish", "Happy little starfish", MessageBoxButtons.OK, MessageBoxIcon.Information); MyTimer.Enabled = true; } if (mf.snail != null) { MyTimer.Enabled = false; currentAquarium.AllAnimalsCollection.Add(mf.snail); currentAquarium.MolluskCollection.Add(mf.snail); var aw = new AnimalWrapper(mf.snail); animals.Add(aw); this.Controls.Add(aw.picBox); textBox2MolluskNumber.Text = currentAquarium.MolluskCollection.Count().ToString(); MessageBox.Show("You successfully added a new snail", "Happy little snail", MessageBoxButtons.OK, MessageBoxIcon.Information); MyTimer.Enabled = true; } } }
private void button2AddMullusk_Click(object sender, EventArgs e) { MulluskForm mf = new MulluskForm(); mf.ShowDialog(); }