Example #1
0
 private void SendMsgToHim()
 {
     if (this.Online)
     {
         if (this.textBox1.Text.Trim() != "")
         {
             this.timer1.Start();
             AddMsg("我说:(" + UserInf.GetTime() + ")\n    " + this.textBox1.Text);
             string checkmsg = this.textBox1.Text;
             send.Msg        = checkmsg.Replace(';', ';');
             send.ToDistUser = Myfriend;
             send.send();
             this.textBox1.Text = "";
             this.label2.Text   = "";
         }
         else
         {
             this.label2.Text = "不能发送空消息!";
         }
     }
     else
     {
         MessageBox.Show("对不起!对方不在线!服务器不支持离线发送!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Example #2
0
        private void ShowMsg()
        {
            bool   isHaveWin  = false;
            int    MsgId      = 0;
            int    hand       = 0;
            string msg        = "";
            string FriendName = UserInf.GetUserNameByUserNumber(parameter[1].Trim());

            if (FriendName.Trim() == "")
            {
                msg += parameter[1].Trim();
            }
            else
            {
                msg += FriendName;
            }
            msg += ":(" + UserInf.GetTime() + ")\n    " + parameter[2].Trim();
            for (int i = 0; i < ShareDate.WinName.Count; i++)
            {
                if (parameter[1].Trim() == ShareDate.WinName[i].ToString().Trim())
                {
                    hand      = int.Parse(ShareDate.WinHand[i].ToString());
                    isHaveWin = true;
                    break;
                }
            }
            MsgId = ShareDate.Msg.Add(msg);
            if (isHaveWin)
            {
                TrafficMsg.PostMessage(hand, 500, MsgId, 0);             //向目标窗口发送消息
            }
            else
            {
                TrafficMsg.PostMessage(ShareDate.MainFormHand, 501, int.Parse(parameter[1]), MsgId);             //闪烁图标
            }
        }