private void RoomFrm_FormClosing(object sender, FormClosingEventArgs e) { _client.CommandReceived -= new CommandReceivedEventHandler(room_CommandReceived); RoomUsersContainer roomUser = new RoomUsersContainer(new RoomContainer(_roomName, "")); roomUser.AddUser(_client.UserName); _client.SendCommand(new CommandContainer(CommandType.UserDisconnectedFromRoom, roomUser)); }
private void OpenRoomWindow(string roomName) { if (_client.Connected) { if (!IsRoomWindowOpened(roomName)) { RoomFrm roomWindow = new RoomFrm(_client, roomName); _roomWindowsList.Add(roomWindow); roomWindow.FormClosed += new FormClosedEventHandler(roomWindow_FormClosed); roomWindow.StartPosition = FormStartPosition.CenterParent; roomWindow.Show(this); RoomUsersContainer roomUser = new RoomUsersContainer(new RoomContainer(roomName, "")); roomUser.AddUser(_client.UserName); _client.SendCommand(new CommandContainer(CommandType.ConnectToRoom, roomUser)); _client.SendCommand(new CommandContainer(CommandType.RequestRoomArchive, new RoomContainer(roomUser.GetRoom().Name))); } } }