44 lines
No EOL
1.3 KiB
C#
44 lines
No EOL
1.3 KiB
C#
/* Generated by MyraPad at 28/08/2021 22:04:11 */
|
|
using Myra.Graphics2D.UI;
|
|
using Sentry;
|
|
using System;
|
|
|
|
namespace Sledgemapper.UI
|
|
{
|
|
public partial class PlayerWindow
|
|
{
|
|
protected readonly Window Window;
|
|
protected readonly CommunicationManager CommunicationManager;
|
|
|
|
public PlayerWindow(CommunicationManager communicationManager, Window window)
|
|
{
|
|
Window = window;
|
|
CommunicationManager = communicationManager;
|
|
|
|
BuildUI();
|
|
BtnNewCampaign.Click += OnButtonInvitePlayerClicked;
|
|
}
|
|
|
|
private async void OnButtonInvitePlayerClicked(object sender, EventArgs e)
|
|
{
|
|
var localContent = ((TextButton)sender).GetParentContentInWindow<PlayerWindow>();// localWindow.Content as PlayerWindow;
|
|
var isValid = localContent.Content.TxtCampaign.ValidateTextbox();
|
|
if (!isValid)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var successful = false;
|
|
try
|
|
{
|
|
await CommunicationManager.Api.InvitePlayer(State.Instance.CampaignName, localContent.Content.TxtCampaign.Text);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
SentrySdk.CaptureException(ex);
|
|
}
|
|
localContent.Window.Close();
|
|
|
|
}
|
|
}
|
|
} |