private void button1_Click(object sender, EventArgs e) { if(listBox1.SelectedItems.Count==0) { MessageBox.Show("You should select some clients to send a message"); return; } if(textBox1.Text.Trim().Length == 0) { MessageBox.Show("You should enter a message to send"); return; } string message = JSON.Method("ServerMessage", textBox1.Text); PokeInWCF.MessageFormat Mess = new PokeInWCF.MessageFormat(); Mess.Clients = new string[listBox1.SelectedItems.Count]; listBox1.SelectedItems.CopyTo(Mess.Clients, 0); Mess.Message = message; lock (PokeInWCF.Messages) { PokeInWCF.Messages.Add(Mess); } }
private void button1_Click(object sender, EventArgs e) { if (listBox1.SelectedItems.Count == 0) { MessageBox.Show("You should select some clients to send a message"); return; } if (textBox1.Text.Trim().Length == 0) { MessageBox.Show("You should enter a message to send"); return; } string message = JSON.Method("ServerMessage", textBox1.Text); PokeInWCF.MessageFormat Mess = new PokeInWCF.MessageFormat(); Mess.Clients = new string[listBox1.SelectedItems.Count]; listBox1.SelectedItems.CopyTo(Mess.Clients, 0); Mess.Message = message; lock (PokeInWCF.Messages) { PokeInWCF.Messages.Add(Mess); } }