Exemplo n.º 1
0
        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();
                }
            }
        }
Exemplo n.º 2
0
 public void StoreServer()
 {
     ServerStateManager.StoreServerInstance(server);
 }