Beispiel #1
0
        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();
        }
Beispiel #2
0
        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();
        }
Beispiel #3
0
        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();
        }