ui
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Michele Scandura 2021-09-15 16:54:41 +01:00
parent dd97d5ec4e
commit b8d27a2a6f
6 changed files with 191 additions and 123 deletions

View file

@ -11,16 +11,16 @@ namespace Sledgemapper.UI
private readonly CommunicationManager CommunicationManager;
private readonly Window Window;
private readonly TinyMessengerHub Messenger;
private readonly Desktop Desktop;
private Settings _settings;
public CampaignList(CommunicationManager communicationManager, Window window, TinyMessengerHub messenger, Settings settings)
public CampaignList(CommunicationManager communicationManager, Window window, TinyMessengerHub messenger, Settings settings, Desktop desktop)
{
BuildUI();
CommunicationManager = communicationManager;
Window = window;
Messenger = messenger;
Desktop= desktop;
_settings = settings;
BtnNewCampaign.Click += (s, e) =>
{
@ -56,13 +56,13 @@ namespace Sledgemapper.UI
Title = "New campaign"
};
var content = new CampaignWindow();
var content = new CampaignWindow(CommunicationManager,window,Messenger);
//content.BtnNewCampaign.Text = "N";
content.BtnNewCampaign.Click += OnButtonNewCampaignClicked;
//content.BtnNewCampaign.Click += OnButtonNewCampaignClicked;
window.Content = content;
window.ShowModal(Desktop);
content.TxtCampaign.SetKeyboardFocus();
window.ShowModal(desktop);
//content.TxtCampaign.SetKeyboardFocus();
}
@ -85,61 +85,61 @@ namespace Sledgemapper.UI
campaignSelected = true;
}
private async void OnButtonNewCampaignClicked(object sender, EventArgs e)
{
var localContent = ((TextButton)sender).GetParentContentInWindow<CampaignWindow>();// localWindow.Content as PlayerWindow;
//private async void OnButtonNewCampaignClicked(object sender, EventArgs e)
//{
// var localContent = ((TextButton)sender).GetParentContentInWindow<CampaignWindow>();// localWindow.Content as PlayerWindow;
var isValid = localContent.Content.TxtCampaign.ValidateTextbox();
if (!isValid)
{
return;
}
// var isValid = localContent.Content.TxtCampaign.ValidateTextbox();
// if (!isValid)
// {
// return;
// }
//if (CommunicationManager.Connection.State != HubConnectionState.Connected)
//{
// lblConnectionStatus.Text = "Connecting";
// await CommunicationManager.Connection.StartAsync();
// UpdateConnectionState(CommunicationManager.Connection);
//}
// //if (CommunicationManager.Connection.State != HubConnectionState.Connected)
// //{
// // lblConnectionStatus.Text = "Connecting";
// // await CommunicationManager.Connection.StartAsync();
// // UpdateConnectionState(CommunicationManager.Connection);
// //}
var successful = false;
try
{
await CommunicationManager.Api.NewCampaign(localContent.Content.TxtCampaign.Text);
// var successful = false;
// try
// {
// await CommunicationManager.Api.NewCampaign(localContent.Content.TxtCampaign.Text);
//if (result)
//{
// CommunicationManager.SessionData.SessionName = localContent.TxtSession.Text;
// CommunicationManager.SessionData.MapEntityAdded -= OnMapEntityAdded;
// CommunicationManager.SessionData.MapEntityDeleted -= OnMapEntityDeleted;
// CommunicationManager.SessionData.MapEntityAdded += OnMapEntityAdded;
// CommunicationManager.SessionData.MapEntityDeleted += OnMapEntityDeleted;
//}
//successful = result;
//var result2 = await CommunicationManager.Connection?.InvokeAsync<Session>("JoinSession", localContent.TxtSession.Text);
//CommunicationManager.SessionData.SessionId = result2.SessionId;
//CommunicationManager.SessionData.SessionName = localContent.TxtSession.Text;
}
catch (Exception ex)
{
//ExceptionlessClient.Default.SubmitException(ex);
}
// //if (result)
// //{
// // CommunicationManager.SessionData.SessionName = localContent.TxtSession.Text;
// // CommunicationManager.SessionData.MapEntityAdded -= OnMapEntityAdded;
// // CommunicationManager.SessionData.MapEntityDeleted -= OnMapEntityDeleted;
// // CommunicationManager.SessionData.MapEntityAdded += OnMapEntityAdded;
// // CommunicationManager.SessionData.MapEntityDeleted += OnMapEntityDeleted;
// //}
// //successful = result;
// //var result2 = await CommunicationManager.Connection?.InvokeAsync<Session>("JoinSession", localContent.TxtSession.Text);
// //CommunicationManager.SessionData.SessionId = result2.SessionId;
// //CommunicationManager.SessionData.SessionName = localContent.TxtSession.Text;
// }
// catch (Exception ex)
// {
// //ExceptionlessClient.Default.SubmitException(ex);
// }
//if (successful)
//{
// //CommunicationManager.SessionData.SessionName = localContent.TxtSession.Text;
// //CommunicationManager.SessionData.Map = CommunicationManager.SessionData.Map;
// //CommunicationManager.SessionData.Overlays = CommunicationManager.SessionData.Overlays;
// //CommunicationManager.SessionData.Walls = CommunicationManager.SessionData.Walls;
// //lblSessionName.Text = CommunicationManager.SessionData.SessionName;
// //MenuConnectSync.Enabled = true;
// //MenuConnectUpload.Enabled = true;
// localWindow.Close();
//}
// //if (successful)
// //{
// // //CommunicationManager.SessionData.SessionName = localContent.TxtSession.Text;
// // //CommunicationManager.SessionData.Map = CommunicationManager.SessionData.Map;
// // //CommunicationManager.SessionData.Overlays = CommunicationManager.SessionData.Overlays;
// // //CommunicationManager.SessionData.Walls = CommunicationManager.SessionData.Walls;
// // //lblSessionName.Text = CommunicationManager.SessionData.SessionName;
// // //MenuConnectSync.Enabled = true;
// // //MenuConnectUpload.Enabled = true;
// // localWindow.Close();
// //}
localContent.Window.Close();
// localContent.Window.Close();
}
//}
public async Task LoadCampaigns()
{