Example #1
0
        private void BTBirdCreate_Click(object sender, EventArgs e)
        {
            string name = Inputs.InputName(TBBirdName.Text);

            if (name != null)
            {
                int weight = Inputs.InputWeight(TBBirdWeight.Text);
                if (weight > 0)
                {
                    bool flying = false;
                    if (CBFlying.Checked)
                    {
                        flying = true;
                    }
                    bool domestic = false;
                    if (CBDomestic.Checked)
                    {
                        domestic = true;
                    }

                    ClassBirds bird = new ClassBirds(flying, domestic, weight, name);
                    SupportingMethods.zoo.Add(bird);
                    birds.Add(bird);
                }
                else
                {
                    SupportingMethods.ShowMistake(content: "Вес введен неверно");
                }
            }

            TBBirdName.Clear();
            TBBirdWeight.Clear();
        }
Example #2
0
        private void BTBirdCreate_Click(object sender, EventArgs e)
        {
            if (Main.animals.Count >= Main.animals.Capacity)
            {
                support.ShowInfo("Коллекция расширена");
                Main.animals.ExpandCollection();
            }

            if (!support.IsStringEmpty(TBBirdName.Text) &&
                !support.IsStringEmpty(TBBirdWeight.Text))
            {
                string name     = TBBirdName.Text;
                int    weight   = Convert.ToInt32(TBBirdWeight.Text);
                bool   flying   = CBFlying.Checked;
                bool   domestic = CBDomestic.Checked;

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

            TBBirdWeight.Clear();
            TBBirdName.Clear();
        }
Example #3
0
        private void BTBirdCreate_Click(object sender, EventArgs e)
        {
            if (!SupportingMethods.IsStringEmpty(TBBirdName.Text) &&
                !SupportingMethods.IsStringEmpty(TBBirdWeight.Text))
            {
                string name     = TBBirdName.Text;
                int    weight   = Convert.ToInt32(TBBirdWeight.Text);
                bool   flying   = CBFlying.Checked;
                bool   domestic = CBDomestic.Checked;

                InsertBirdToArray(name, weight, flying, domestic);
            }
            else
            {
                SupportingMethods.ShowMistake();
            }

            TBBirdWeight.Clear();
            TBBirdName.Clear();
        }
Example #4
0
        private void BTBirdCreate_Click(object sender, EventArgs e)
        {
            if (!support.IsStringEmpty(TBBirdName.Text) &&
                !support.IsStringEmpty(TBBirdWeight.Text))
            {
                string name     = TBBirdName.Text;
                int    weight   = Convert.ToInt32(TBBirdWeight.Text);
                bool   flying   = CBFlying.Checked;
                bool   domestic = CBDomestic.Checked;

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

            TBBirdWeight.Clear();
            TBBirdName.Clear();
        }