コード例 #1
0
        /// <summary>
        /// Мы реагируем на то, когда пользователь выберет себе футболиста и отображаем информацию
        /// о нем в полной мере.
        /// </summary>
        private void listPlayer1_DoubleClick(object sender, EventArgs e)
        {
            if (listPlayer1.SelectedItems.Count > 0)
            {
                footballer1          = firstPlayer.Team[listPlayer1.SelectedIndices[0]];
                picturePlayer1.Image = imageList2.Images[listPlayer1.SelectedIndices[0]];
                infoLabel1.Text      = footballer1.ToString();

                if (round % 2 == 1)
                {
                    CreateRandomFootballer();
                }

                listPlayer1.Visible        = listPlayer2.Visible = false;
                infoLabel1.Visible         = infoLabel2.Visible = picturePlayer1.Visible =
                    picturePlayer2.Visible = goButton.Visible = true;
            }
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Person o  = new Person("Adak", "Adacki", "20.03.1980");
            Person o2 = new Student("Babak", "Babacki", "13.04.1990", 2, 1, 12345);
            Person o3 = new Footballer("Cabak", "Cabacki", "10.08.1986", "defence", "FC Barcelona");

            Console.WriteLine(o.ToString());
            Console.WriteLine(o2.ToString());
            Console.WriteLine(o3.ToString());

            Student    stu = new Student("Dabak", "Dabacki", "22.12.1990", 2, 5, 54321);
            Footballer soc = new Footballer("Ebak", "Ebacki", "14.09.1984", "attack", "Chelsea");

            Console.WriteLine(stu.ToString());
            Console.WriteLine(soc.ToString());

            ((Footballer)o3).ScoreAGoal();
            soc.ScoreAGoal();
            soc.ScoreAGoal();

            FootballPlayer f1 = new FootballPlayer("Fabak", "Fabacki", "14.09.1984", "attack", "Chelsea");

            f1.ScoreAGoal();

            Console.WriteLine(f1.ToString());

            HandballPlayer h1 = new HandballPlayer("Gabak", "Gabacki", "05.05.2020", "Defence", "HanPlay");

            h1.ScoreAGoal();

            Console.WriteLine(h1.ToString());
            Console.WriteLine(o3.ToString());
            Console.WriteLine(soc.ToString());

            Console.WriteLine("-----------------------------------");

            ((Student)o2).AddRate("PO", "14.03.2020", 5.0);
            ((Student)o2).AddRate("Databases", "14.03.2020", 4.0);

            Console.WriteLine(o2.ToString());

            stu.AddRate("Databases", "01.05.2019", 5.0);
            stu.AddRate("Computer Science", "13.03.2020", 5.5);
            stu.AddRate("Computer technology", "15.03.2020", 3.5);
            Console.WriteLine("---------------Powinny być 3 oceny -------------");

            Console.WriteLine(stu.ToString());

            Console.WriteLine("---------------Powinny być 2 oceny -------------");

            stu.DeleteRate("Computer technology", "15.03.2020", 3.5);

            Console.WriteLine(stu.ToString());

            stu.AddRate("AWW", "02.04.2011", 4.5);
            stu.DeleteAllRates();

            Console.WriteLine("---------------Powinny być 0 oceny -------------");

            Console.WriteLine(stu.ToString());


            Console.ReadKey();
        }