48 lines
No EOL
1.3 KiB
C#
48 lines
No EOL
1.3 KiB
C#
/* Generated by MyraPad at 28/08/2021 19:49:08 */
|
|
using Myra.Graphics2D.UI;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Sledgemapper.UI
|
|
{
|
|
public partial class PlayerList
|
|
{
|
|
protected readonly Window Window;
|
|
protected readonly CommunicationManager CommunicationManager;
|
|
|
|
public PlayerList(CommunicationManager communicationManager, Window window)
|
|
{
|
|
BuildUI();
|
|
Window = window;
|
|
CommunicationManager = communicationManager;
|
|
BtnInvitePlayer.Click += (s, e) =>
|
|
{
|
|
Window.Close();
|
|
ShowAddPLayerWindow();
|
|
};
|
|
|
|
}
|
|
|
|
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()
|
|
{
|
|
Window window = new()
|
|
{
|
|
Title = "Invite player",
|
|
Content = new PlayerWindow(CommunicationManager, Window)
|
|
};
|
|
|
|
window.ShowModal(Window.Desktop);
|
|
|
|
}
|
|
}
|
|
} |