Beispiel #1
0
 /// <summary>
 /// Adds the passed games to the list of games, and saves the newly updated list to the file.
 /// </summary>
 /// <param name="newGame">The games to be added.</param>
 public void AddGame(List <Game> newGame)
 {
     foreach (Game game in newGame)
     {
         StoreGameCollection.Add(game);
     }
     FileHandler.WriteFile(Constants.GameFileListName, StoreGameCollection);
 }
Beispiel #2
0
 /// <summary>
 /// Removes the passed game from the list of games, and saves the newly updated list to the file.
 /// If the game passed is the same game as the SelectedGame, SelectedGame will be set to null.
 /// </summary>
 /// <param name="removeGame">The game to be removed.</param>
 public void RemoveGame(Game removeGame)
 {
     if (SelectedGame == removeGame)
     {
         SelectedGame = null;
     }
     StoreGameCollection.Remove(removeGame);
     FileHandler.WriteFile(Constants.GameFileListName, StoreGameCollection);
 }
Beispiel #3
0
 /// <summary>
 /// Removes the passed games from the list of games, and saves the newly updated list to the file.
 /// If one of the games passed is the same game as the SelectedGame, SelectedGame will be set to null.
 /// </summary>
 /// <param name="removeGames">The list of games to be removed.</param>
 public void RemoveGame(List <Game> removeGames)
 {
     foreach (Game game in removeGames)
     {
         if (SelectedGame == game)
         {
             SelectedGame = null;
         }
         StoreGameCollection.Remove(game);
     }
     FileHandler.WriteFile(Constants.GameFileListName, StoreGameCollection);
 }
Beispiel #4
0
 /// <summary>
 /// Replaces the old game with the newly edited game, and saves the newly updated list to the file.
 /// </summary>
 /// <param name="oldGame">The game to be replaced.</param>
 /// <param name="newGame">The new game, that replaces the old one.</param>
 public void EditGame(Game oldGame, Game newGame)
 {
     StoreGameCollection[StoreGameCollection.IndexOf(oldGame)] = newGame;
     FileHandler.WriteFile(Constants.GameFileListName, StoreGameCollection);
 }
Beispiel #5
0
 /// <summary>
 /// Adds the passed game to the list of games, and saves the newly updated list to the file.
 /// </summary>
 /// <param name="newGame">The game to be added.</param>
 public void AddGame(Game newGame)
 {
     StoreGameCollection?.Add(newGame);
     FileHandler.WriteFile(Constants.GameFileListName, StoreGameCollection);
 }