/// <summary> /// The code which will run in a new thread after the game finish time has passed in order /// to updated the game record to COMPLETED. /// </summary> /// <param name="game">The Game being updated</param> /// <param name="hubInterface">The HubInterface used to to send live updates to users.</param> /// <param name="timeToWait">The number of milliseconds to sleep before the thread starts.</param> private static void Run_CompleteGame(Game game, int timeToWait, HubInterface hubInterface) { Thread.Sleep(timeToWait); //Call the DataAccessLayer to complete the game in the DB GameDAL gameDAL = new GameDAL(); Response response = gameDAL.CompleteGame(game.GameID); //If the response was successful send out the game completed messages to players if (response.IsSuccessful()) { hubInterface.UpdateGameCompleted(game, false); } }