Test-time reflected event checker

Server UI components work with new system
Events for loading and unloading TorchSessions
Commands report information again.
Catch, log, and rethrow errors that occur in Torch-handled SE events
This commit is contained in:
Westin Miller
2017-08-24 20:24:07 -07:00
parent 4b2fee7614
commit 140000df55
19 changed files with 230 additions and 73 deletions

View File

@@ -21,6 +21,7 @@ using Sandbox.ModAPI;
using SteamSDK;
using Torch.API;
using Torch.API.Managers;
using Torch.API.Session;
using Torch.Managers;
using Torch.Server.Managers;
using Torch.ViewModels;
@@ -43,11 +44,20 @@ namespace Torch.Server
public void BindServer(ITorchServer server)
{
_server = server;
server.SessionLoaded += () =>
{
var multiplayer = server.CurrentSession?.Managers.GetManager<MultiplayerManagerDedicated>();
DataContext = multiplayer;
};
var sessionManager = server.Managers.GetManager<ITorchSessionManager>();
sessionManager.SessionLoaded += BindSession;
sessionManager.SessionUnloading += UnbindSession;
}
private void BindSession(ITorchSession session)
{
Dispatcher.Invoke(() => DataContext = _server?.CurrentSession?.Managers.GetManager<MultiplayerManagerDedicated>());
}
private void UnbindSession(ITorchSession session)
{
Dispatcher.Invoke(() => DataContext = null);
}
private void KickButton_Click(object sender, RoutedEventArgs e)