using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Client { public partial class RoomListForm : Form { public RoomListForm() { InitializeComponent(); } private void btnEnter_Click(object sender, EventArgs e) { if (lbxRoom.SelectedItem == null) { MessageBox.Show("Please select a room."); return; } ChatRoomForm chatRoomForm = new ChatRoomForm(); chatRoomForm.Text = lbxRoom.SelectedItem.ToString(); chatRoomForm.ShowDialog(); } private void btnCreate_Click(object sender, EventArgs e) { string roomName = tbxRoomName.Text; if (string.IsNullOrEmpty(roomName)) { MessageBox.Show("Please input a room name."); return; } ChatRoomForm chatRoomForm = new ChatRoomForm(); chatRoomForm.Text = roomName; chatRoomForm.ShowDialog(); } private void RoomListForm_Activated(object sender, EventArgs e) { lbxRoom.Items.Clear(); } } }