Exemple #1
0
 public static void RemoveTalking(Chat _talk)
 {
     foreach (Chat tk in TalkList)
     {
         if (tk.ToName == _talk.ToName)
         {
             TalkList.Remove(_talk);
             return;
         }
     }
 }
Exemple #2
0
 public void CreatTalking(object _text)
 {
     string text = _text.ToString();
     int indexof = text.IndexOf(";");
     string fromuser = text.Substring(0, indexof);
     string message = text.Substring(indexof + 1);
     Chat talk = new Chat(message);
     talk.UserName = Username;
     talk.ToName = fromuser;
     talk.ToIP = GetIP(fromuser);
     TalkList.Add(talk);
     talk.Show();
 }
Exemple #3
0
 private void ContactListView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if (ContactListView.SelectedItem == null)
         return;
     UserContact contact = new UserContact((UserContact)ContactListView.SelectedItem);
     string login = contact.Nickname;
     foreach (var cont in Contacts)
     {
         if (cont.Nickname == login)
         {
             var chat = new Chat(CurrentUserId, cont.Id, cont.Nickname, this);
             ChatStartedGuids.Add(cont.Id);
             chat.Uid = cont.Id.ToString();
             ChatWindows.Add(chat);
             chat.Show();
             ContactListView.SelectedItem = null;
             break;
         }
     }
 }
Exemple #4
0
        // Chat Room
        private void btnChatRoom_Click(object sender, EventArgs e)
        {
            chat = new Chat
                                 {
                                     ReceiveName = "PUBLIC",
                                     Text = @"广播: " + UserName + @" -> all",
                                     ChatType = ChatType.Public,
                                     Stream = Stream,
                                     UserName = UserName
                                 };
            DisableChatButton();

            chat.Show();
        }
Exemple #5
0
        // Talk
        private void btnChat_Click(object sender, EventArgs e)
        {
            if (lbxOnline.SelectedItem == null)
            {
                MessageBox.Show("请选择一个接收者!", "发送消息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            chat = new Chat
                                {
                                    ChatType = ChatType.Private,
                                    Text = @"聊天: " + UserName + @" -> " + lbxOnline.SelectedItem,
                                    ReceiveName = lbxOnline.SelectedItem.ToString(),
                                    Stream = Stream,
                                    UserName = UserName
                                };

            DisableChatButton();

            chat.Show();
        }
 public void Send(Chat.Registration.Message message)
 {
     History.Add(string.Format("{0}: {1}", message.Sender, message.MessageMember));
 }
Exemple #7
0
 private void listView1_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     if (this.listView1.SelectedItems.Count > 0)
     {
         ListViewItem lvitem = this.listView1.SelectedItems[0];
         string toname = lvitem.Text;
         string toips = lvitem.Tag.ToString();
         Chat t = isHaveTalk(toname);
         if (t != null)
         {
             t.Focus();
         }
         else
         {
             Chat talk = new Chat();
             talk.UserName = Username;
             talk.ToName = toname;
             talk.ToIP = toips;
             TalkList.Add(talk);
             talk.Show();
         }
     }
 }
Exemple #8
0
 private void clearHistoryToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Chat.Clear();
     Log.Clear();
 }