private void ConnectionRequest(object sender, MouseEventArgs e)
{
if (textBox1.Text.Equals(string.Empty))
{
MessageBox.Show("Ingrese una identificacion");
return;
}
_childThread = new Thread(new ParameterizedThreadStart(StartConnection)) { IsBackground = true };
_childThread.Start(this.textBox1.Text);
_connected = true;
if (_connected)
{
button1.MouseClick -= ConnectionRequest;
button1.MouseClick += Disconnect;
textBox1.Enabled = false;
button1.Text = "Desconectar";
button2.Enabled = true;
button3.Enabled = true;
}
}
private void ConnectionRequest(object sender, MouseEventArgs e)
{
if (textBox1.Text.Equals(string.Empty))
{
MessageBox.Show("Ingrese una identificacion");
return;
}
_childThread = new Thread(new ParameterizedThreadStart(StartConnection)) { IsBackground = true };
_childThread.Start(this.textBox1.Text);
_connected = true;
if (_connected)
{
button1.MouseClick -= ConnectionRequest;
button1.MouseClick += Disconnect;
textBox1.Enabled = false;
button1.Text = "Desconectar";
button2.Enabled = true;
button3.Enabled = true;
}
}