Example #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);
        }
Example #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!");
     }
 }
Example #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!");
     }
 }
Example #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!");
     }
 }
Example #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!");
     }
 }