Esempio n. 1
0
        private void bbt_ok_Click(object sender, EventArgs e)
        {
            Command cmd = new Command(Enum.CommandType_.AddFriend, _userPrimary, _userReference);

            client.SendCommand(cmd);
            cmd = new Command(Enum.CommandType_.ListFriend);
            client.SendCommand(cmd);
        }
Esempio n. 2
0
 public void Receive(string userFriend, string content, Font _fontTemp)
 {
     if (bLoadMessage)
     {
         MessageText mst = new MessageText(content, _fontTemp, 2);
         listmessage.AddLast(mst);
         Command cmd = new Command(Enum.CommandType_.LoadMessage, userFriend, listmessage.Count);
         _client.SendCommand(cmd);
         bLoadMessage = false;
     }
     else
     {
         if (flp_messeage.InvokeRequired)
         {
             this.Invoke(new Receive_delagate(Receive), userFriend, content, _fontTemp);
         }
         else
         {
             if (_bSend && _bRecive)//chưa gởi và chưa nhận
             {
                 string _time = DateTime.Now.ToString();
                 Button a     = new Button();
                 a.Width     = 490;
                 a.Text      = _time;
                 a.BackColor = System.Drawing.Color.Transparent;
                 a.Dock      = DockStyle.None;
                 a.FlatAppearance.BorderSize = 0;
                 a.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
                 a.Enabled   = false;
                 flp_messeage.Controls.Add(a);
             }
             if (_bRecive)
             {
                 Messeage ms = new Messeage(userFriend, content, _fontTemp);
                 ms.Anchor = AnchorStyles.Left;
                 flp_messeage.Controls.Add(ms);
                 flp_messeage.ScrollControlIntoView(ms);
                 _bSend   = true;
                 _bRecive = false;
                 MessageText mst = new MessageText(content, _fontTemp, 2);
                 listmessage.AddLast(mst);
             }
             else
             {
                 Message1 ms = new Message1(content, _fontTemp);
                 ms.Anchor = AnchorStyles.Left;
                 flp_messeage.Controls.Add(ms);
                 flp_messeage.ScrollControlIntoView(ms);
                 MessageText mst = new MessageText(content, _fontTemp, 2);
                 listmessage.AddLast(mst);
             }
         }
     }
 }
Esempio n. 3
0
 private void bbt_findFriend_Click(object sender, EventArgs e)
 {
     if (txt_findFriend.Text == "")
     {
         MessageCustom.Show("Vui lòng nhập Talk ID hay Tên \n người cần kết bạn!", "Thông báo",
                            new Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular,
                                     System.Drawing.GraphicsUnit.Point, ((byte)(0))));
     }
     else
     {
         Command cm = new Command(Enum.CommandType_.FindFriend, txt_findFriend.Text);
         client.SendCommand(cm);
     }
 }
Esempio n. 4
0
        private void bbt_notice_Click(object sender, EventArgs e)
        {
            Form_Notice frm_notice = new Form_Notice(client);

            frm_notice.Show();
            client.Notice_frm = frm_notice;
            Command cmd = new Command(Enum.CommandType_.LoadNotice);

            client.SendCommand(cmd);
        }
Esempio n. 5
0
        private void bbt_ok_Click(object sender, EventArgs e)
        {
            byte[]         dataPicture  = new byte[10000];
            MemoryStream   ms           = new MemoryStream();
            ImageConverter imageConvert = new ImageConverter();

            dataPicture = (byte[])imageConvert.ConvertTo(ptb_avatar.Image, typeof(byte[]));
            _Command.Command cmd = new _Command.Command(Enum.CommandType_.ChangeInformation, txt_username.Text, txt_email.Text, dataPicture, txt_status.Text);
            client.SendCommand(cmd);
            MyGetValue(ptb_avatar.Image, txt_status.Text);
            this.Close();
        }
Esempio n. 6
0
 public void Friend_DoubleClick(object sender, EventArgs e)
 {
     {
         //khi double click vào tab show lient thì gọi form chat với client đó
         if (ClientManager.IsShow(_userFriend) == null)
         {
             Chat form2 = new Chat(client, _userFriend);
             form2.Text = _userFriend;
             ClientManager.listFormChat.Add(form2);
             Command cmd = new Command(CommandType_.LoadMessage, _userFriend, 0);
             client.SendCommand(cmd);
             form2.Show();
         }
     }
 }
Esempio n. 7
0
 private void bbt_gui_Click(object sender, EventArgs e)
 {
     if (_client.socket.Connected)
     {
         if (rTB_content.Text != "")
         {
             Messeage ms = new Messeage(_client.userName, rTB_content.Text, _fontMessage);
             flp_messeage.Controls.Add(ms);
             _fontMessage = rTB_content.Font;
             Command cmd = new Command(Enum.CommandType_.Message, rTB_content.Text, _fontMessage);
             rTB_content.Text = "";
             _client.SendCommand(cmd);
         }
     }
     else
     {
         MessageCustom.Show("Kết nối với client đã bị đóng!", "Thông báo", new Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))));
     }
 }