Exemplo n.º 1
0
        private void Btn_Send_Click(object sender, RoutedEventArgs e)
        {
            if (Tb_Send.Text.Equals(""))
            {
                MessageBox.Show("请输入聊天内容!");
                return;
            }
            TextMessage message = new TextMessage(Global.SINGLECHAT, Tb_Send.Text, RemoteIP);

            instance.SendMessage(message);
            AddNewMessage(Global.GetFormattedMessage(instance.NickName, message.time, message.content));
            Tb_Send.Text = "";
            Tb_Send.Focus();
        }
 private void Btn_Send_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (Tb_Send.Text.Equals(""))
         {
             MessageBox.Show("请输入聊天内容!");
             return;
         }
         TextMessage message = new TextMessage(Global.GROUPCHAT, Tb_Send.Text);
         instance.SendMessage(message);
         Tb_Send.Text = "";
         Tb_Send.Focus();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }