sledgemapper/Sledgemapper/UI/PlayerWindow.Custom.cs
Michele Scandura 75dad86ba4
All checks were successful
continuous-integration/drone/push Build is passing
New campaign system
2021-09-23 09:44:56 +01:00

41 lines
No EOL
1.2 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 CommunicationManager CommunicationManager;
public PlayerWindow(CommunicationManager communicationManager)
{
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);
}
this.GetContainingWindow().Close();
}
}
}