/* Generated by MyraPad at 28/08/2021 19:49:08 */ using System.Threading.Tasks; namespace Sledgemapper.UI { public partial class PlayerList { protected readonly CommunicationManager CommunicationManager; public PlayerList(CommunicationManager communicationManager) { BuildUI(); CommunicationManager = communicationManager; BtnInvitePlayer.Click += (s, e) => { ShowAddPLayerWindow(); this.GetContainingWindow().Close(); }; } public async Task LoadPlayers() { var players = await CommunicationManager.Api.GetPlayers(State.Instance.CampaignName); foreach (var player in players) { var item = new ListItem(); item.ItemName.Text = player.UserName; StackCampaignsList.AddChild(item); } } private void ShowAddPLayerWindow() { new PlayerWindow(CommunicationManager).ShowInModalWindow(Desktop, "Invite player"); } } }