sledgemapper/Sledgemapper/UI/PlayerWindow.Custom.cs
Michele Scandura f15f1c8857
All checks were successful
continuous-integration/drone/push Build is passing
cleanup, refactoring, usual stuff
2021-09-16 11:11:07 +01:00

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();
}
}
}