Ejemplo n.º 1
0
        private async void btn_send_Click(object sender, RoutedEventArgs e)
        {
            if (isConnected == false)
            {
                MessageBox.Show("Ups! You forgot to connect!", "Error!");
            }
            else
            {
                if (txt_message.Text.ToString() == "")
                {
                    MessageBox.Show("Ups! You forgot to enter your message!", "Error!");
                }
                else
                {
                    clientMessage.Name        = client.Name;
                    clientMessage.Textmessage = txt_message.Text.ToString();

                    var chat = new ChatService.ChatServiceClient(channel);
                    chat.sendMessage(clientMessage);

                    UpdateChat();

                    if (stream != null)
                    {
                        await stream.RequestStream.WriteAsync(clientMessage);
                    }
                }
            }
        }