Example #1
0
 public frmAjedrez(int n, String u, HiloComsUDP h)
 {
     nCte            = n;
     usr             = u;
     comsUDP         = h;
     comsUDP.tablero = true;
     InitializeComponent();
     inicializarTablero();
 }
Example #2
0
 private void hilo_VerificaServidorActivo()
 {
     while (comsUDP.serverActive)
     {
         Thread.Sleep(10);
     }
     if (tablero != null)
     {
         CierraTablero(tablero);
     }
     if (comsUDP != null)
     {
         while (comsUDP.serverActive)
         {
             Thread.Sleep(10);
         }
         if (hiloUDP != null)
         {
             hiloUDP.Abort();
         }
         if (comsUDP != null)
         {
             comsUDP.closeClient();
             comsUDP = null;
         }
     }
     if (hcs != null)
     {
         hcs.Abort();
     }
     if (hcoms != null)
     {
         hcoms.cierraCxnS();
         hcoms = null;
     }
     if (hiloReg != null)
     {
         hiloReg.Abort();
     }
     if (hiloLoseOP != null)
     {
         hiloLoseOP.Abort();
     }
     if (hiloAquireOP != null)
     {
         hiloAquireOP.Abort();
     }
     MessageBox.Show("El Servidor CerrĂ³ la Conexion");
 }
Example #3
0
 private void frmPrincipal_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (tablero != null)
     {
         CierraTablero(tablero);
     }
     if (hiloAquireOP != null)
     {
         hiloAquireOP.Abort();
     }
     if (hiloLoseOP != null)
     {
         hiloLoseOP.Abort();
     }
     if (hiloVerifica != null)
     {
         hiloVerifica.Abort();
     }
     if (hiloReg != null)
     {
         hiloReg.Abort();
     }
     if (hcs != null)
     {
         hcs.Abort();
     }
     if (hcoms != null)
     {
         hcoms.cierraCxnS();
         hcoms = null;
     }
     if (comsUDP != null)
     {
         while (comsUDP.serverActive)
         {
             Thread.Sleep(10);
         }
         if (hiloUDP != null)
         {
             hiloUDP.Abort();
         }
         if (comsUDP != null)
         {
             comsUDP.closeClient();
             comsUDP = null;
         }
     }
 }
Example #4
0
 private void hilo_LocalizaNumero()
 {
     while (hcoms.nCte == -1)
     {
         Thread.Sleep(10);
     }
     nCte    = hcoms.nCte;
     comsUDP = new HiloComsUDP(201 + nCte);
     hiloUDP = new Thread(new ThreadStart(comsUDP.startplayer));
     hiloUDP.Start();
     comsUDP.enviaMensaje("identifica@" + usr + "@" + nCte.ToString());
     hiloVerifica = new Thread(new ThreadStart(hilo_VerificaServidorActivo));
     hiloVerifica.Start();
     hiloLoseOP = new Thread(new ThreadStart(hilo_VerificaLoseOP));
     hiloLoseOP.Start();
     hiloAquireOP = new Thread(new ThreadStart(hilo_VerificaAquireOP));
     hiloAquireOP.Start();
 }