Ejemplo n.º 1
0
        /// <summary>adds a new message to the message list</summary>
        internal void AddMessage(Message newMessage)
        {
            MessageImpl theMsg = (MessageImpl)newMessage;
            string      entry  = "[" + theMsg.originator + "] " + theMsg.msg;

            Console.WriteLine("received new: " + entry);
            m_messages.Items.Add(entry);
        }
Ejemplo n.º 2
0
 private void m_sendMsgButton_Click(object sender, System.EventArgs e)
 {
     if (m_listener != null)
     {
         MessageImpl msg = new MessageImpl(m_listener.userName, m_messageTextbox.Text);
         try {
             m_chatroom.broadCast(msg);
         } catch (Exception ex) {
             Console.WriteLine("exception encountered, while broadcasting: " + ex);
             MessageBox.Show("an exception occured, while broadcasting!");
         }
     }
     else
     {
         MessageBox.Show("not connected, connect first!");
     }
 }
Ejemplo n.º 3
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!");
     }
 }
Ejemplo n.º 4
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!");
     }
 }
Ejemplo n.º 5
0
 private void m_sendMsgButton_Click(object sender, System.EventArgs e) {
     if (m_listener != null) {
         MessageImpl msg = new MessageImpl(m_listener.userName, m_messageTextbox.Text);
         try {
             m_chatroom.broadCast(msg);
         } catch (Exception ex) {
             Console.WriteLine("exception encountered, while broadcasting: " + ex);
             MessageBox.Show("an exception occured, while broadcasting!");
         }
     } else {
         MessageBox.Show("not connected, connect first!");
     }
 }