almost completed map load flow
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Michele Scandura 2021-09-16 15:47:10 +01:00
parent 8c6df57fb1
commit e18cbb157c
5 changed files with 48 additions and 24 deletions

View file

@ -17,11 +17,11 @@ namespace Sledgemapper.UI
{
public partial class MainWidget
{
private readonly CommunicationManager CommunicationManager;
private CommunicationManager CommunicationManager { get; }
private readonly TinyMessengerHub _messenger;
private TinyMessengerHub Messenger { get; }
private readonly GameWindow Window;
private GameWindow Window { get; }
public MainWidget(CommunicationManager communicationManager, TinyMessengerHub messenger, GameWindow window)
{
@ -29,7 +29,7 @@ namespace Sledgemapper.UI
CommunicationManager = communicationManager;
Window = window;
_messenger = messenger;
Messenger = messenger;
MenuConnectLogin.Selected += OnMenuConnectLoginSelected;
MenuConnectSync.Selected += OnMenuConnectSyncSelected;
MenuFileLoad.Selected += OnMenuFileLoadSelected;
@ -63,11 +63,11 @@ namespace Sledgemapper.UI
BtnToolbarRoom.Click += OnBtnToolbarRoomClicked;
BtnToolbarDelete.Click += OnBtnToolbarDeleteClicked;
_messenger.Subscribe<LoginSuccesfulMessage>(OnLoginSuccesfulMessage);
_messenger.Subscribe<SignalrConnectionUpdateMessage>(OnSignalrConnectionUpdateMessage);
_messenger.Subscribe<MapOpenedMessage>(OnMapOpenedMessage);
_messenger.Subscribe<CenterOnTileMessage>(OnCenterOnTileMessage);
_messenger.Subscribe<CampaignSelectedMessage>(OnCampaignSelectedMessage);
Messenger.Subscribe<LoginSuccesfulMessage>(OnLoginSuccesfulMessage);
Messenger.Subscribe<SignalrConnectionUpdateMessage>(OnSignalrConnectionUpdateMessage);
Messenger.Subscribe<MapOpenedMessage>(OnMapOpenedMessage);
Messenger.Subscribe<CenterOnTileMessage>(OnCenterOnTileMessage);
Messenger.Subscribe<CampaignSelectedMessage>(OnCampaignSelectedMessage);
}
private void OnCampaignSelectedMessage(CampaignSelectedMessage obj)
@ -85,7 +85,7 @@ namespace Sledgemapper.UI
private void OnMapOpenedMessage(MapOpenedMessage obj)
{
lblMap.Text = CommunicationManager.SessionData.SessionName;
lblMap.Text = obj.MapName;
MenuConnectSync.Enabled = true;
MenuConnectUpload.Enabled = true;
CommunicationManager.SessionData.MapEntityAdded -= OnMapEntityAdded;
@ -141,7 +141,7 @@ namespace Sledgemapper.UI
Title = "Login"
};
var content = new LoginRegisterWindow(CommunicationManager, _messenger);
var content = new LoginRegisterWindow(CommunicationManager, Messenger);
window.Content = content;
window.ShowModal(Desktop);
}
@ -159,7 +159,7 @@ namespace Sledgemapper.UI
Title = "New mapping session"
};
var content = new SessionWindow(CommunicationManager, _messenger);
var content = new SessionWindow(CommunicationManager, Messenger);
window.Content = content;
window.ShowModal(Desktop);
@ -293,7 +293,7 @@ namespace Sledgemapper.UI
return;
}
new SessionWindow(CommunicationManager, _messenger).ShowInModalWindow(Desktop, "Join mapping session");
new SessionWindow(CommunicationManager, Messenger).ShowInModalWindow(Desktop, "Join mapping session");
}
private void OnMenuViewShowCellNUmbersSelected(object sender, EventArgs e)
@ -313,7 +313,7 @@ namespace Sledgemapper.UI
Title = "Notes"
};
new NoteList(CommunicationManager, _messenger).ShowInModalWindow(Desktop, "Notes");
new NoteList(CommunicationManager, Messenger).ShowInModalWindow(Desktop, "Notes");
}
private void CenterOnSelectedTile()
@ -337,7 +337,7 @@ namespace Sledgemapper.UI
return;
}
new CampaignWindow(CommunicationManager, _messenger).ShowInModalWindow(Desktop, "New campaign"); ;
new CampaignWindow(CommunicationManager, Messenger).ShowInModalWindow(Desktop, "New campaign"); ;
}
private async void OnMenuCampaignOpen(object sender, EventArgs e)
@ -347,7 +347,7 @@ namespace Sledgemapper.UI
return;
}
var content = new CampaignList(CommunicationManager, _messenger);
var content = new CampaignList(CommunicationManager, Messenger);
await content.LoadCampaigns();
content.ShowInModalWindow(Desktop, "Campaigns");
}
@ -371,7 +371,7 @@ namespace Sledgemapper.UI
return;
}
var content = new MapList(CommunicationManager);
var content = new MapList(CommunicationManager, Messenger);
await content.LoadMaps();
content.ShowInModalWindow(Desktop, "Maps");
}