private void RecvMessage() { try { string strTemp = chat.ReceiveMessage(lblUserName.Text); if (strTemp.Trim().Length > 0) { if (strTemp.Substring(0, 7) == "Ser@ver") { NotifyWindow nw; nw = new NotifyWindow(strTemp.Substring(8, strTemp.Length - 9).ToString()); nw.Font = new Font("Verdana", 8.25F); nw.SetDimensions(strTemp.Length + 210, 50); nw.Notify(); //if (Form1.bNoAlert == false) // speech.Speak(strTemp.Substring(8, strTemp.Length - 9).ToString(), SpFlags); } else { strMess = strTemp; string[] strUser = strMess.Split(':'); userFlag = true; for (int i = 0; i < arrOUsers.Count; i++) { if (strUser[0] == arrOUsers[i].ToString()) userFlag = false; } if (userFlag == true) { arrOUsers.Add(strUser[0]); Form f = new PrivateMessage(strUser[0], strMess); f.Show(); } } } } catch (Exception ex) { //MessageBox.Show("Error in connecting to the chat server."); } }
private void RecvMessage() { try { string strTemp = chat.ReceiveMessage(lblUserName.Text); if (strTemp.Trim().Length > 0) { if (strTemp.Substring(0, 7) == "Ser@ver") { NotifyWindow nw; nw = new NotifyWindow(strTemp.Substring(8, strTemp.Length - 9).ToString()); nw.Font = new Font("Verdana", 8.25F); nw.SetDimensions(strTemp.Length + 210, 50); nw.Notify(); //if (Form1.bNoAlert == false) // speech.Speak(strTemp.Substring(8, strTemp.Length - 9).ToString(), SpFlags); } else { strMess = strTemp; string[] strUser = strMess.Split(':'); userFlag = true; for (int i = 0; i < arrOUsers.Count; i++) { if (strUser[0] == arrOUsers[i].ToString()) userFlag = false; } if (userFlag == true) { arrOUsers.Add(strUser[0]); Form f = new PrivateMessage(strUser[0], strMess); f.Show(); } } } } catch (Exception ex) { //MessageBox.Show("Error in connecting to the chat server."); } }
private void timer1_Tick(object sender, EventArgs e) { try { if (Form1.strMess.Trim().Length > 0) { string[] strU = Form1.strMess.Split(':'); string strM = string.Empty; if (strU[0] == strUser) { for (int i = 1; i < strU.Length; i++) { strM = strM + strU[i]; } rtbMessage.SelectedText = strU[0] + ": "; rtbMessage.SelectedRtf = strM; Form1.strMess = ""; rtbMessage.ScrollToCaret(); FlashWindowEx(this); } if (this.WindowState == FormWindowState.Minimized && Form1.bNoAlert == false) { int iRw = 0; int iHt = 0; NotifyWindow nw; RichTextBox rtb = new RichTextBox(); rtb.Rtf = strM; if (rtb.Text.Trim().Length == 0) { nw = new NotifyWindow(strU[0].ToString(), "Emotions"); nw.SetDimensions(220, 70); } else { iRw = (rtb.Text.Length / 30); iRw = iRw + 1; iHt = (iRw * 25) + 40; nw = new NotifyWindow(strU[0].ToString(), rtb.Text); nw.SetDimensions(220, iHt); } font = new Font("Verdana", 8.25F); nw.Font = font; nw.Notify(); rtb.Dispose(); //font.Dispose(); } } } catch (Exception ex) { //MessageBox.Show("Error in connecting to the chat server."); } }