You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tcpipSocket/Chat/Client/RoomListForm.cs

53 lines
1.1 KiB

2 years ago
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();
}
}
}