예제 #1
0
파일: Form1.cs 프로젝트: wangchunlei/MyGit
        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);
            }
        }
예제 #2
0
        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);
            }
        }