示例#1
0
        /// <summary>
        /// Disconnects all players from the server
        /// </summary>
        public void DisconnectAll()
        {
            Log.Info("Disconnecting all users");
            foreach (var player in ConnectedPlayers.Keys)
            {
                player.Disconnect();
                ConnectedPlayers[player].Abort(); //Kill the thread
            }

            ConnectedPlayers.Clear();
        }
 private void Cancel()
 {
     IsReady = false;
     try
     {
         lobbyServer.DisconnectFromLobby();
         ClientProxyManager.Instance.RemoveLobby();
     }
     catch (Exception)
     {
         MessageBox.Show("Connection lost.", "Hanksite", MessageBoxButton.OK);
         Application.Current.Shutdown();
         return;
     }
     ConnectedPlayers.Clear();
 }