sledgemapper/Sledgemapper/UI/PlayerList.Custom.cs
Michele Scandura 7e3e645fc9
All checks were successful
continuous-integration/drone/push Build is passing
fixes and cleanup
2021-09-21 11:09:26 +01:00

38 lines
No EOL
1.1 KiB
C#

/* 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");
}
}
}