Example #1
0
        /// <summary>
        /// Calls close game method of model and post results in
        /// both players.
        /// </summary>
        /// <param name="nameOfGame"></param>
        /// <param name="playerId"></param>
        private void Close(string nameOfGame, string playerId)
        {
            ServerModel model      = ServerModel.GetInstance();
            string      opponentId = model.GetCompetitorOf(Context.ConnectionId);

            model.Close(nameOfGame);
            // close both players
            Clients.Client(opponentId).closeGame(false);
            Clients.Client(playerId).closeGame(true);
        }
 public void CloseOpenConnections()
 {
     // close old connections
     if (ClientModel.IsOpen)
     {
         ClientModel.Close();
     }
     if (ServerModel.IsOpen)
     {
         ServerModel.Close();
     }
 }