예제 #1
0
 public void ShowPrivateChat(object source, PrivateChatUser e)
 {
     this.Dispatcher.Invoke(() =>
     {
         //Console.WriteLine(usernameWindow3Owner);
         PrivateChat win3 = new PrivateChat(communication, chatService, e.user);
         win3.Show();
     });
 }
예제 #2
0
 //Nhan duoc yeu cau chat rieng tu server
 void RequestPrivate(string[] cmd)
 {
     if (listpChat.Count == 0)
     {
         this.Invoke(() =>
         {
             pChat = new PrivateChat(this);
             pChat.SetFrom(cmd[1]);
             pChat.Show();
             listpChat.Add(pChat);
         });
     }
 }
예제 #3
0
        private void Button_Click_4(object sender, RoutedEventArgs e)
        {
            try
            {
                Console.WriteLine(usernameWindow3Owner);
                object item          = dataGrid.SelectedItem;
                string username      = (dataGrid.SelectedCells[0].Column.GetCellContent(item) as TextBlock).Text;
                string message       = textboxSendMessage.Text;
                string messageToSend = username + " " + message;
                chatService.sendMessage(messageToSend, "SendForOne");

                PrivateChat win3 = new PrivateChat(communication, chatService, username);
                win3.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Selecteaza un utilizator cu care sa vorbesti");
            }
        }
예제 #4
0
 //Nhan tin nhan rieng tu server
 void PrivateMessFromServer(string[] cmd)
 {
     if (listpChat.Count == 0) // lúc này chưa có form pChat vì form pChat trước đã bị đóng lại
     {
         this.Invoke(() =>
         {
             pChat = new PrivateChat(this);
             //Check = false;
             pChat.SetFrom(cmd[2]);
             pChat.Show();
             listpChat.Add(pChat);
             pChat.richTextBox1.Text += "Server : " + cmd[1] + "\r\n";
         });
     }
     else
     {
         var p = listpChat.SingleOrDefault(r => r.getFrom() == cmd[2]);
         if (p != null)
         {
             p.richTextBox1.Text += "Server : " + cmd[1] + "\r\n";
         }
     }
 }
예제 #5
0
 //Remove khoi list privateChat server khi dong form
 public void RemovePrivate(PrivateChat f)
 {
     listpChat.Remove(f);
 }