Ejemplo n.º 1
0
        private void BTAnimalCreate_Click(object sender, EventArgs e)
        {
            string name = Inputs.InputName(TBAnimalName.Text);

            if (name != null)
            {
                int weight = Inputs.InputWeight(TBAnimalWeight.Text);
                if (weight > 0)
                {
                    KingdomAnimal animal = new KingdomAnimal(weight, name);
                    SupportingMethods.zoo.Add(animal);
                    animals.Add(animal);
                }
            }
            TBAnimalName.Clear();
            TBAnimalWeight.Clear();
        }
Ejemplo n.º 2
0
        private void BTAnimalCreate_Click(object sender, EventArgs e)
        {
            if (!SupportingMethods.IsStringEmpty(TBAnimalName.Text) &&
                !SupportingMethods.IsStringEmpty(TBAnimalWeight.Text))
            {
                string name   = TBAnimalName.Text;
                int    weight = Convert.ToInt32(TBAnimalWeight.Text);

                InsertAnimalToArray(name, weight);
            }
            else
            {
                SupportingMethods.ShowMistake();
            }

            TBAnimalName.Clear();
            TBAnimalWeight.Clear();
        }
Ejemplo n.º 3
0
        private void BTAnimalCreate_Click(object sender, EventArgs e)
        {
            if (!support.IsStringEmpty(TBAnimalName.Text) &&
                !support.IsStringEmpty(TBAnimalWeight.Text))
            {
                string name   = TBAnimalName.Text;
                int    weight = Convert.ToInt32(TBAnimalWeight.Text);

                sortedList.AddToList(name, weight);
            }
            else
            {
                support.ShowMistake();
            }

            TBAnimalName.Clear();
            TBAnimalWeight.Clear();
        }
Ejemplo n.º 4
0
        private void BTAnimalCreate_Click(object sender, EventArgs e)
        {
            if (Main.animals.Count >= Main.animals.Capacity)
            {
                support.ShowInfo("Коллекция расширена");
                Main.animals.ExpandCollection();
            }

            if (!support.IsStringEmpty(TBAnimalName.Text) &&
                !support.IsStringEmpty(TBAnimalWeight.Text))
            {
                string name   = TBAnimalName.Text;
                int    weight = Convert.ToInt32(TBAnimalWeight.Text);

                Main.animals.Enqueue(new KingdomAnimal(weight, name));
            }
            else
            {
                support.ShowMistake();
            }

            TBAnimalName.Clear();
            TBAnimalWeight.Clear();
        }