private void hilo_VerificaAquireOP() { bool aquire = false; while (true) { if (comsUDP.oponent != "" && aquire == false) { aquire = true; oponent = comsUDP.oponent; op = comsUDP.nOp; hcoms.accion = "AQUIRE_OP@" + oponent + "@" + op.ToString(); EnableBTN(btn[1], false); tablero = new frmAjedrez(nCte, usr, comsUDP); tablero.ShowDialog(); tablero = null; } else { if (comsUDP.oponent == "" && aquire == true) { aquire = false; EnableBTN(btn[1], true); } } Thread.Sleep(10); } }
void CierraTablero(frmAjedrez ch) { if (ch.InvokeRequired) { ch.Invoke(new delCierraTablero(CierraTablero), ch); } else { ch.Close(); ch = null; } }