public static async void DrawChilds(HerosView form, List<Models.HeroModel> heroList , List<Models.HeroModel> parentsList) { int i = 0; foreach (Models.HeroModel hero in heroList) { form.Controls.Add(new Label() { Name = "childTitle" + i.ToString(), Location = new Point(13 + (600 / heroList.Count) * i, 240), Text = "Ребенок " + i.ToString() + ":", AutoSize = true, }); form.Controls.Add(new Label() { Name = "childIntLabel" + i.ToString(), Location = new Point(13 + (600 / heroList.Count) * i, 270), Text = "Интеллект: " + hero.intellegent.ToString(), AutoSize = true, }); form.Controls.Add(new Label() { Name = "childStrLabel" + i.ToString(), Location = new Point(13 + (600 / heroList.Count) * i, 290), Text = "Сила: " + hero.strength.ToString(), AutoSize = true, }); form.Controls.Add(new Label() { Name = "childAgilLabel" + i.ToString(), Location = new Point(13 + (600 / heroList.Count) * i, 310), Text = "Ловкость: " + hero.agility.ToString(), AutoSize = true, }); form.Controls.Add(new Label() { Name = "childPwrLabel" + i.ToString(), Location = new Point(13 + (600 / heroList.Count) * i, 330), Text = "Итого: " + hero.resultPower.ToString(), AutoSize = true, }); form.Controls.Add(new Label() { Name = "childPrntsLabel" + i.ToString(), Location = new Point(13 + (600 / heroList.Count) * i, 360), Text = "Родители:\n" + hero.parent1.name + " и " + hero.parent2.name, AutoSize = true, }); i++; await Task.Delay(1500); } form.label2.Text += Controller.FindMiddleResult(heroList) + " против " + Controller.FindMiddleResult(parentsList); form.label2.Visible = true; form.button3.Visible = true; }
private void button1_Click(object sender, EventArgs e) { if (!Controller.IsInputValid(this)) { this.label1.Text = "Введите корректные данные (μ должно быть не меньше l):"; } else { int parentsCount = int.Parse(textBox1.Text); int childsCount = int.Parse(textBox2.Text); herosList = Controller.CreateHeroList(parentsCount); HerosView nextForm = new HerosView(herosList, parentsCount, childsCount); this.Hide(); nextForm.Show(); } }
public static void DrawParents(HerosView form, List<Models.HeroModel> heroList) { int i = 0; foreach (Models.HeroModel hero in heroList) { form.Controls.Add(new Label() { Name = "heroTitle" + i.ToString(), Location = new Point(13 + (600 / heroList.Count) * i, 80), Text = hero.name + ":", AutoSize = true, }); form.Controls.Add(new Label() { Name = "heroIntLabel" + i.ToString(), Location = new Point(13 + (600 / heroList.Count) * i, 110), Text = "Интеллект: " + hero.intellegent.ToString(), AutoSize = true, }); form.Controls.Add(new Label() { Name = "heroStrLabel" + i.ToString(), Location = new Point(13 + (600 / heroList.Count) * i, 130), Text = "Сила: " + hero.strength.ToString(), AutoSize = true, }); form.Controls.Add(new Label() { Name = "heroAgilLabel" + i.ToString(), Location = new Point(13 + (600 / heroList.Count) * i, 150), Text = "Ловкость: " + hero.agility.ToString(), AutoSize = true, }); form.Controls.Add(new Label() { Name = "heroPwrLabel" + i.ToString(), Location = new Point(13 + (600 / heroList.Count) * i, 180), Text = "Итого: " + hero.resultPower.ToString(), AutoSize = true, }); i++; } }