private void timer_Tick(object sender, EventArgs e) { string message = ""; Server.Service1 server = new Server.Service1(); server.setConnected(lbl_me.Text, true, true); server.getChatText(lbl_me.Text, ref message); if (!(message == "")) { msg n = new msg(message, lbl_connecteduser.Text); flowLayoutPanel1.Controls.Add(n); flowLayoutPanel1.ScrollControlIntoView(n); server.setChatToEmpty(lbl_me.Text); } bool ispassed; bool passed; server.checkimage(lbl_me.Text, out passed, out ispassed); if (passed) { int length; server.getimagelength(lbl_me.Text, out length, out ispassed); byte[] array = new byte[length]; server.getChatImage(lbl_me.Text, ref array); Image img = byteArrayToImage(array); imagemsg p = new imagemsg(lbl_connecteduser.Text, img); flowLayoutPanel1.Controls.Add(p); flowLayoutPanel1.ScrollControlIntoView(p); server.setImageToEmpty(lbl_me.Text); } }
//---------------------------------------------------------------- private void btn_send_Click(object sender, EventArgs e) { Server.Service1 server = new Server.Service1(); bool ispassed, passed; server.SIsOfflineUser(lbl_connecteduser.Text, out passed, out ispassed); if (ispassed) { if (passed) { MessageBox.Show("oops your friend has gone ! talk to u later :'D"); EnterUser.EnterUserForm.Show(); this.Hide(); } else { bool isHeConnected = false; bool isHeConnectedPassed = false; server.isConnected(lbl_connecteduser.Text, ref isHeConnected, ref isHeConnectedPassed); if (isHeConnected) { server.setChatToText(lbl_connecteduser.Text, txt_message.Text); if (!(txt_message.Text == "")) { msg n = new msg(txt_message.Text, lbl_me.Text); flowLayoutPanel1.Controls.Add(n); flowLayoutPanel1.ScrollControlIntoView(n); } } else { MessageBox.Show("User not connected"); } /*msg n = new msg(txt_message.Text); * flowLayoutPanel1.Controls.Add(n);*/ txt_message.Clear(); } } }
private void btn_Send_Click(object sender, EventArgs e) { if (txt_Message.Text != "") { string message = txt_Message.Text; message += "^"; message += lbl_me.Text; Server.Service1 server = new Server.Service1(); if (lbl1_Email.Text != "") { server.setGroupChatText(lbl1_Email.Text, message); } if (lbl2_Email.Text != "") { server.setGroupChatText(lbl2_Email.Text, message); } if (lbl3_Email.Text != "") { server.setGroupChatText(lbl3_Email.Text, message); } if (lbl4_Email.Text != "") { server.setGroupChatText(lbl4_Email.Text, message); } msg my = new msg(txt_Message.Text, EnterUser.EnterUserForm.email); flowLayoutPanel1.Controls.Add(my); flowLayoutPanel1.ScrollControlIntoView(my); txt_Message.Clear(); } }
private void timer_Tick(object sender, EventArgs e) { Server.Service1 server = new Server.Service1(); server.setConnected(lbl_me.Text, true, true); List <string> messagesList = new List <string>(); string[] messagesArray = messagesList.ToArray(); server.getGroupChatText(lbl_me.Text, ref messagesArray); foreach (string message in messagesArray) { string actualMessage = ""; string userName = ""; bool flipFlag = false; foreach (char chr in message) { if (flipFlag) { userName += chr; } if (chr == '^') { flipFlag = true; } if (!flipFlag) { actualMessage += chr; } } msg n = new msg(actualMessage, userName); flowLayoutPanel1.Controls.Add(n); flowLayoutPanel1.ScrollControlIntoView(n); } server.setGroupChatToEmpty(lbl_me.Text); }