Example #1
0
        private void Parar()
        {
            servidor.Parar();
            servidor.ListaClientesMudou -= servidor_ListaClientesMudou;
            servidor = null;

            txtPorta.Enabled = true;
            btnIniciar.Text = "Iniciar";
        }
Example #2
0
        private void Iniciar()
        {
            int porta;

            if (!int.TryParse(txtPorta.Text, out porta))
            {
                MessageBox.Show("Preencha a porta corretamente.", "Trova", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                txtPorta.Focus();
                return;
            }

            servidor = new Servidor(porta);
            servidor.ListaClientesMudou += servidor_ListaClientesMudou;
            servidor.Iniciar();

            txtPorta.Enabled = false;
            btnIniciar.Text = "Parar";
        }