cleanup and fixes

This commit is contained in:
Michele Scandura 2021-09-20 16:30:42 +01:00
parent 4fd77a1f17
commit 77befef8e0
16 changed files with 78 additions and 230 deletions

View file

@ -87,6 +87,11 @@ namespace Sledgemapper.UI
private async void OnMapOpenedMessage(MapOpenedMessage obj)
{
lblMap.Text = obj.MapName;
State.Instance.MapId = obj.MapId;
State.Instance.MapName = obj.MapName;
CommunicationManager.SessionData.SessionName = obj.MapName;
CommunicationManager.SessionData.SessionId = obj.MapId;
MenuConnectSync.Enabled = true;
MenuConnectUpload.Enabled = true;
CommunicationManager.SessionData.MapEntityAdded -= OnMapEntityAdded;
@ -163,23 +168,7 @@ namespace Sledgemapper.UI
}
private void OnMenuConnectNewSelected(object sender, EventArgs e)
{
if (!((MenuItem)sender).Enabled)
{
return;
}
Window window = new()
{
Title = "New mapping session"
};
var content = new SessionWindow(CommunicationManager, Messenger);
window.Content = content;
window.ShowModal(Desktop);
}
private void UpdateConnectionState(HubConnection connection)
{
@ -302,16 +291,6 @@ namespace Sledgemapper.UI
_windowEditor.ShowModal(Desktop);
}
private void OnMenuConnectJoinSelected(object sender, EventArgs e)
{
if (!((MenuItem)sender).Enabled)
{
return;
}
new SessionWindow(CommunicationManager, Messenger).ShowInModalWindow(Desktop, "Join mapping session");
}
private void OnMenuViewShowCellNUmbersSelected(object sender, EventArgs e)
{
State.Instance.ShowCellNumbers = !State.Instance.ShowCellNumbers;
@ -475,7 +454,7 @@ namespace Sledgemapper.UI
return;
}
new MapWindow(CommunicationManager).ShowInModalWindow(Desktop, "New map");
new MapWindow(CommunicationManager, Messenger).ShowInModalWindow(Desktop, "New map");
}
//TODO Refactor