private void xmppClient_OnMessage(object sender, MessageEventArgs e) { DisplayEvent("OnMessage"); if (e.Message.Type == MessageType.error) { return; } if (e.Message.Body != null) { if (!Util.ChatForms.ContainsKey(e.Message.From.Bare)) { //get nickname from the roster listview string nick = e.Message.From.Bare; var item = listContacts.Items[e.Message.From.Bare]; if (item != null) { nick = item.Text; } //-------------------------------------------------------------------------- var f = new HangoutChat(e.Message.From, xmppClient, nick); f.Show(); //fom chat show f.IncomingMessage(e.Message); // message in //-------------------------------------------------------------------------- } } }
private void chatToolStripMenuItem_Click(object sender, System.EventArgs e)//เรียกใช้ฟรอมจากชื่อของผู้ที่แชท { if (listContacts.SelectedItems.Count > 0) { var item = listContacts.SelectedItems[0]; if (!Util.ChatForms.ContainsKey(item.Name)) { var f = new HangoutChat(item.Name, xmppClient, item.Text); f.Show(); } } }
private void xmppClient_OnMessage(object sender, MessageEventArgs e) //จัดการข้อความเข้า { DisplayEvent("ข้อความเข้า"); // แสดงผลการทำงาน ข้อความเข้า if (e.Message.Body != null) { if (!Util.ChatForms.ContainsKey(e.Message.From.Bare)) { //get nickname from the roster listview string nick = e.Message.From.Bare; var item = listContacts.Items[e.Message.From.Bare]; if (item != null) { nick = item.Text; } var f = new HangoutChat(e.Message.From, xmppClient, nick); f.Show(); f.IncomingMessage(e.Message); } } }