48 lines
No EOL
1.3 KiB
C#
48 lines
No EOL
1.3 KiB
C#
/* Generated by MyraPad at 02/09/2021 16:26:04 */
|
|
using Myra.Graphics2D.UI;
|
|
using Sentry;
|
|
using System;
|
|
|
|
namespace Sledgemapper.UI
|
|
{
|
|
public partial class MapWindow
|
|
{
|
|
public CommunicationManager CommunicationManager { get; }
|
|
|
|
public MapWindow(CommunicationManager communicationManager)
|
|
{
|
|
CommunicationManager= communicationManager;
|
|
BuildUI();
|
|
BtnNewCampaign.Click += OnButtonNewMapClicked;
|
|
}
|
|
|
|
private async void OnButtonNewMapClicked(object sender, EventArgs e)
|
|
{
|
|
Container container = ((TextButton)sender).Parent;
|
|
while (!(container is Window))
|
|
{
|
|
container = container.Parent;
|
|
}
|
|
var localWindow = (Window)container;
|
|
var localContent = localWindow.Content as MapWindow;
|
|
var isValid = localContent.TxtCampaign.ValidateTextbox();
|
|
if (!isValid)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var successful = false;
|
|
try
|
|
{
|
|
await CommunicationManager.Api.NewSession(State.Instance.CampaignName, localContent.TxtCampaign.Text);
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
SentrySdk.CaptureException(ex);
|
|
}
|
|
|
|
localWindow.Close();
|
|
}
|
|
}
|
|
} |