// Show a new party window, host name is used to enable/disable the invite button private void showPartyWindow(string host) { if (host == username) { LobbyProxy.CreateParty(); } //party?.Leave() // Maybe need to leave any existing party first, but it shouldn't be needed party = new PartyControl(username, host, leaveParty, LobbyProxy.SendMessageParty, startGame); foreach (var player in LobbyProxy.GetPartyMembers()) { // Host and player are already in the lobby, due to being required in constructor if (player.UserName != username && player.UserName != host) { party.AddPlayer(player.UserName); } } partyGrid.Children.Add(party); inviteButton.IsEnabled = (username == host); }