private void RemoveRoom(string RoomName) { try { Room sts = ActiveRoomList.Where(se => se.Name == RoomName).First(); if (RoomManager.ShutdownRoom(sts.Pid)) { Success("Room \"" + sts.Name + "\" has been closed."); } else { Error("There was a problem in closing the room \"" + sts.Name + "\"."); } } catch { Error("Unable to locate a Room with that name."); } }
private void CreateRoom() { if (ActiveRoomList.Where(s => s.Name == RoomName.Text || s.Port == int.Parse(PortNumber.Text)).Any()) { Error("Unable to create room: A room with the same name or port number is already running."); return; } RoomManager.StartRoom(RoomName.Text, int.Parse(PortNumber.Text), Password.Text, IP.Text); Thread.Sleep(500); // Give it a second to start up before we refresh the room list. BindRoomList(); RoomName.Text = ""; PortNumber.Text = CurrentPortNumber.ToString(); Password.Text = ""; Success("The room has been started."); }