Beispiel #1
0
        private void joinButton_Click(object sender, EventArgs e)
        {
            //check for selection
            //if (chatList1.SelectedItem != null)
            //    {
            //        //check list box for selected chatroom
            //        string chatroom = chatList1.SelectedItem.ToString();
            //    chatroom = chatroom.Substring(0, chatroom.IndexOf(" "));
            //    // Need to use join method in socket controller
            //    if (sctctrl.SendJoinChatroomRequest(chatroom))
            //    {

            //            // Open Chat Manager form if connection is complete
            //            FormChatRoom F = new FormChatRoom(sctctrl, chatroom);
            //            ChatRoomForms.Add(F);
            //            F.Show();
            //        }

            //        // tell user join failed
            //        else
            //        {
            //            MessageBox.Show("Join unsuccessful");
            //        }
            //    }
            //    else
            //    {
            //        MessageBox.Show("Select a Chatroom to join.");
            //    }

            //Used for testing chatroom form - feel free to delete and uncomment above
            FormChatRoom FormChat = new FormChatRoom(sctctrl, "chatroom");

            ChatRoomForms.Add(FormChat);
            FormChat.Show();
        }
Beispiel #2
0
 //create chat button second click
 private void createChatBtn_SecondClick(object sender, EventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(createText.Text))
     {
         //create chat method in socket controller
         string newChatroomID = sctctrl.sendCreateChatroomRequest(createText.Text);
         if (newChatroomID != "")
         {
             FormChatRoom tempform = new FormChatRoom(sctctrl, newChatroomID);
             tempform.Show();
             this.ChatRoomForms.Add(tempform);
             this.sctctrl.SendChatroomsRequest();
         }
         else
         {
             MessageBox.Show("Failed to create new Chatroom.");
         }
     }
     else
     {
         MessageBox.Show("Please name Chat.");
     }
 }