this.Hide();
private void button1_Click(object sender, EventArgs e)
{
// тут какой-то код
}
private void label_Click(object sender, EventArgs e)
{
Label lb = sender as Label;
lb.Content = "какой-то текст";
// или
int x;
switch((sender as Label).Name)
{
case "label": x = 0; break;
case "label2": x = 1; break;
case "label3": x = 2; break;
default: x = -1; break;
}
}
public void TakeMessage(string btnStatus, string userName, Button btnTest)
{
if (userName == "")
{
MessageBox.Show("Введите Ваше имя!");
}
else if (btnStatus == "Red")
{
btnTest.BackColor = Color.Green;
btnTest.Text = "Свободно";
}
else
{
btnTest.BackColor = Color.Red;
btnTest.Text = userName;
}
}
private void btnClick(object sender, EventArgs e)
{
var btn = sender as Button;
if (btn.BackColor == Color.Green)
{
btnStatus = "Green";
}
else
{
btnStatus = "Red";
}
Server.SendMessageToAll(btnStatus, tbLogin.Text);
TakeMessage(btnStatus, tbLogin.Text, btn);
}