persistence, mediator

This commit is contained in:
Michele 2020-11-06 23:53:37 +00:00
parent 2372fbb620
commit e96a3ef09f
15 changed files with 284 additions and 34 deletions

View file

@ -13,7 +13,7 @@ using System.IO;
using System.Linq;
using System;
using System.Collections.Concurrent;
using Sledgemapper.Entities;
using Sledgemapper.Shared.Entities;
namespace Sledgemapper
{
@ -58,13 +58,12 @@ namespace Sledgemapper
Window.AllowUserResizing = true;
Players = new List<Player>();
connection = new HubConnectionBuilder()
.WithAutomaticReconnect()
#if DEBUG
.WithUrl("http://localhost:5000/ChatHub")
#else
.WithUrl("http://hub.michelescandura.com:5000/ChatHub")
#endif
.Build();
// .WithAutomaticReconnect()
.WithUrl("http://localhost:5000/SledgemapperHub")
// .WithUrl("http://hub.michelescandura.com:5000/SledgemapperHub")
.Build();
connection.On<SessionData>("UpdateMap", (map) =>
{
@ -262,7 +261,11 @@ namespace Sledgemapper
}
successful = session != null;
}
catch { }
catch (Exception ex)
{
}
if (successful)
{
_session = textbox.Text;
@ -276,8 +279,8 @@ namespace Sledgemapper
window.Closed += (s, a) =>
{
// Called when window is closed
};
// Called when window is closed
};
window.ShowModal(_desktop);
};
@ -297,8 +300,8 @@ namespace Sledgemapper
RowSpacing = 3,
};
// Set partitioning configuration
grid.ColumnsProportions.Add(new Proportion(ProportionType.Auto));
// Set partitioning configuration
grid.ColumnsProportions.Add(new Proportion(ProportionType.Auto));
grid.ColumnsProportions.Add(new Proportion(ProportionType.Fill));
grid.RowsProportions.Add(new Proportion(ProportionType.Auto));
grid.RowsProportions.Add(new Proportion(ProportionType.Auto));
@ -318,15 +321,15 @@ namespace Sledgemapper
content.Widgets.Add(grid);
// var content = new VerticalStackPanel();
// var textbox = new TextBox();
// TextButton button = new TextButton
// {
// Text = "Start",
// HorizontalAlignment = HorizontalAlignment.Center
// };
button.Click += async (s, e) =>
{
// var content = new VerticalStackPanel();
// var textbox = new TextBox();
// TextButton button = new TextButton
// {
// Text = "Start",
// HorizontalAlignment = HorizontalAlignment.Center
// };
button.Click += async (s, e) =>
{
if (string.IsNullOrWhiteSpace(textbox.Text))
{
return;
@ -353,14 +356,14 @@ namespace Sledgemapper
window.Close();
}
};
//content.Widgets.Add(textbox);
content.Widgets.Add(button);
//content.Widgets.Add(textbox);
content.Widgets.Add(button);
window.Content = content;
window.Closed += (s, a) =>
{
// Called when window is closed
};
// Called when window is closed
};
window.ShowModal(_desktop);
};