Ejemplo n.º 1
0
 /// <summary>
 /// 开始与选中的好友私聊
 /// </summary>
 protected void StartChatting()
 {
     // 判断是否选中
     if (listViewFriends.SelectedItems.Count > 0)
     {
         string   key = listViewFriends.SelectedItems[0].Text;
         FormChat formChat;
         // 判断是否已经在聊天
         if (!owner.formChats.ContainsKey(key))
         {
             formChat = new FormChat(owner, key);
             owner.formChats.Add(key, formChat);
         }
         else
         {
             formChat = owner.formChats[key];
         }
         owner.showFormChatDelegate(formChat);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 由主窗体来打开指定的FormChat
 /// </summary>
 /// <param name="formChat">要打开的FormChat</param>
 public void OnShowFormChat(FormChat formChat)
 {
     formChat.Show();
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 构造函数,主动连接时
 /// </summary>
 /// <param name="main">主窗体</param>
 /// <param name="owner">聊天窗口</param>
 /// <param name="socket"></param>
 public P2PChatClient(FormMain main, FormChat owner, Socket socket)
 {
     this.main   = main;
     this.owner  = owner;
     this.socket = socket;
 }