private async Task StartServerTask() { if (ServerStateManager.isHoldingInstance) { server = ServerStateManager.RestoreServerInstance(); server.OnClientConnected += Server_OnConnectionEstablished; server.OnClientDisconnected += Server_OnClientDisconnected; } else { server = new TCPServer(new ServerConfiguration()); try { await server.Start(SimpleTCPHelper.GetActiveIPv4Address(), START_PORT); Services.Instance.MainWindow.StatusBarViewModel.ServerOnline = true; server.OnClientConnected += Server_OnConnectionEstablished; server.OnClientDisconnected += Server_OnClientDisconnected; } catch { Debugger.Break(); } } }
public void StoreServer() { ServerStateManager.StoreServerInstance(server); }