Esempio n. 1
0
 private void m_sendMsgAsyncButton_Click(object sender, System.EventArgs e)
 {
     if (m_listener != null)
     {
         MessageImpl msg = new MessageImpl(m_listener.userName, m_messageTextbox.Text);
         try {
             BroadCastDelegate bcd = new BroadCastDelegate(m_chatroom.broadCast);
             // async call to broadcast
             bcd.BeginInvoke(msg, null, null);
             // do not wait for response
         } catch (Exception ex) {
             Console.WriteLine("exception encountered, while broadcasting: " + ex);
             MessageBox.Show("an exception occured, while broadcasting!");
         }
     }
     else
     {
         MessageBox.Show("not connected, connect first!");
     }
 }
Esempio n. 2
0
 private void m_sendMsgAsyncButton_Click(object sender, System.EventArgs e) {
     if (m_listener != null) {
         MessageImpl msg = new MessageImpl(m_listener.userName, m_messageTextbox.Text);
         try {
             BroadCastDelegate bcd = new BroadCastDelegate(m_chatroom.broadCast);
             // async call to broadcast
             bcd.BeginInvoke(msg, null, null);
             // do not wait for response
         } catch (Exception ex) {
             Console.WriteLine("exception encountered, while broadcasting: " + ex);
             MessageBox.Show("an exception occured, while broadcasting!");
         }
     } else {
         MessageBox.Show("not connected, connect first!");
     }
 }