/// <summary> /// Método do botão iniciar/parar de jogar. Faz as conexões com os protcolos UDP E TCP, validações de interface e solicita pra jogar/sair. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btStartQuitGame_Click(object sender, EventArgs e) { Movements Game = new Movements(); if (btStartQuitGame.Text == "Jogar") { tcip.UserID = tbUser.Text; tcip.Password = tbPassword.Text; tcip.Server = "larc.inf.furb.br"; udp.Server = "larc.inf.furb.br"; udp.UserID = tbUser.Text; udp.Password = tbPassword.Text; btStartQuitGame.Text = "Sair"; keepAlive = new Thread(new ThreadStart(() => KeepAlive())); keepAlive.Start(); Thread t = new Thread(new ThreadStart(() => StartGame())); t.Start(); } else { Game.QuitGame(); btStartQuitGame.Text = "Jogar"; keepAlive?.Abort(); ClearDataGrids(); } }