Пример #1
0
        private void button_Click(object sender, EventArgs e)
        {
            Button tmpB = (Button)sender;
            ChoosePlayerUI cpui = new ChoosePlayerUI(playerList, null, tmpB,p1,p2);

            cpui.ShowDialog();
        }
Пример #2
0
        private void usersSet(Object sender, EventArgs e)
        {
            Button btnSender = (Button) sender;
            ChoosePlayerUI cpui = new ChoosePlayerUI(playerList, null, btnSender,p1,p2);
            cpui.ShowDialog();
            if(cpui.DialogResult != DialogResult.Abort) {
                if (btnSender.Name == "red") {
                    p1 = cpui.getPlayer();
                } else {
                    p2 = cpui.getPlayer();
                }
                try {
                    btnSender.BackgroundImage = cpui.getPlayer().getAvatarAsImage();
                } catch (Exception ex) {
                    Console.Write(ex.Message);
                }

                if (redSet && bluSet) {
                    blu.Enabled = false;
                    red.Enabled = false;
                }
                if (btnSender.BackgroundImage != null) {
                    if (btnSender.Name == "red") {
                        redSet = true;
                        playingList.Add(cpui.getPlayer());
                    } else {
                        bluSet = true;
                        playingList.Add(cpui.getPlayer());
                    }
                }
            }
        }