private void BTMammalCreate_Click(object sender, EventArgs e) { if (Main.animals.Count >= Main.animals.Capacity) { support.ShowInfo("Коллекция расширена"); Main.animals.ExpandCollection(); } if (!support.IsStringEmpty(TBMammalName.Text) && !support.IsStringEmpty(TBMammalWeight.Text) && !support.IsStringEmpty(TBMammalMaxAge.Text) && !support.IsStringEmpty(TBMammalIncubationPeriod.Text)) { string name = TBMammalName.Text; int weight = Convert.ToInt32(TBMammalWeight.Text); int incubationPeriod = Convert.ToInt32(TBMammalIncubationPeriod.Text); int lifeExpectancy = Convert.ToInt32(TBMammalMaxAge.Text); Main.animals.Enqueue(new ClassMammals(incubationPeriod, lifeExpectancy, weight, name)); } else { support.ShowMistake(); } TBMammalWeight.Clear(); TBMammalName.Clear(); TBMammalMaxAge.Clear(); TBMammalIncubationPeriod.Clear(); }
private void BTAnimalCreate_Click(object sender, EventArgs e) { string name = Inputs.InputName(TBMammalName.Text); if (name != null) { int weight = Inputs.InputWeight(TBMammalWeight.Text); if (weight > 0) { int incubationPeriod = Inputs.InputIncubationPeriod(TBIncubationPeriod.Text); if (incubationPeriod > 0) { int lifeExtrancy = Inputs.InputLifeExpectancy(TBMaxAge.Text); if (lifeExtrancy > 0) { ClassMammals mammal = new ClassMammals(incubationPeriod, lifeExtrancy, weight, name); SupportingMethods.zoo.Add(mammal); mammals.Add(mammal); } else { SupportingMethods.ShowMistake("Продолжительность жизни введена неверно"); } } else { SupportingMethods.ShowMistake("Период вынашивания введен неверно"); } } else { SupportingMethods.ShowMistake(content: "Вес введен неверно"); } } TBIncubationPeriod.Clear(); TBMammalName.Clear(); TBMammalWeight.Clear(); TBMaxAge.Clear(); }
private void BTMammalCreate_Click(object sender, EventArgs e) { if (!SupportingMethods.IsStringEmpty(TBMammalName.Text) && !SupportingMethods.IsStringEmpty(TBMammalWeight.Text) && !SupportingMethods.IsStringEmpty(TBMammalMaxAge.Text) && !SupportingMethods.IsStringEmpty(TBMammalIncubationPeriod.Text)) { string name = TBMammalName.Text; int weight = Convert.ToInt32(TBMammalWeight.Text); int incubationPeriod = Convert.ToInt32(TBMammalIncubationPeriod.Text); int lifeExpectancy = Convert.ToInt32(TBMammalMaxAge.Text); InsertMammalToArray(name, weight, incubationPeriod, lifeExpectancy); } else { SupportingMethods.ShowMistake(); } TBMammalWeight.Clear(); TBMammalName.Clear(); TBMammalMaxAge.Clear(); TBMammalIncubationPeriod.Clear(); }
private void BTMammalCreate_Click(object sender, EventArgs e) { if (!support.IsStringEmpty(TBMammalName.Text) && !support.IsStringEmpty(TBMammalWeight.Text) && !support.IsStringEmpty(TBMammalMaxAge.Text) && !support.IsStringEmpty(TBMammalIncubationPeriod.Text)) { string name = TBMammalName.Text; int weight = Convert.ToInt32(TBMammalWeight.Text); int incubationPeriod = Convert.ToInt32(TBMammalIncubationPeriod.Text); int lifeExpectancy = Convert.ToInt32(TBMammalMaxAge.Text); sortedList.AddToList(name, weight, incubationPeriod, lifeExpectancy); } else { support.ShowMistake(); } TBMammalWeight.Clear(); TBMammalName.Clear(); TBMammalMaxAge.Clear(); TBMammalIncubationPeriod.Clear(); }