Ejemplo n.º 1
0
        public static IGame AddGame(IGame newGameProto)
        {
            if (_currentUser == null)
            {
                throw new ArgumentNullException();
            }
            var newGame = new GamePlaceHolder(newGameProto, _currentUser.ID);

            _currentUser.OwnedGames.Add(newGame);
            SerializeHandling.Serialize(_users);
            return(newGame);
        }
Ejemplo n.º 2
0
        private static void ShowCommands()
        {
            User  miel = new User("Miel");
            IGame BoI  = new GamePlaceHolder(Constants.TestGame, miel.ID);

            Buy       buyGame       = new Buy(BoI);
            Download  downloadGame  = new Download(BoI);
            Install   installGame   = new Install(BoI);
            Start     startGame     = new Start(BoI);
            Uninstall uninstallGame = new Uninstall(BoI);
            Update    updateGame    = new Update(BoI);


            buyGame.Execute();
            Console.ReadLine();
            downloadGame.Execute();
            Console.ReadLine();
            installGame.Execute();
            Console.ReadLine();
            startGame.Execute();
            Console.ReadLine();
            uninstallGame.Execute();
            Console.ReadLine();
            updateGame.Execute();
            Console.ReadLine();

            CommandContext uniCmd = new CommandContext(buyGame);

            uniCmd.Execute();
            Console.ReadLine();
            uniCmd = new CommandContext(downloadGame);
            uniCmd.Execute();
            Console.ReadLine();
            uniCmd = new CommandContext(installGame);
            uniCmd.Execute();
            Console.ReadLine();
            uniCmd = new CommandContext(startGame);
            uniCmd.Execute();
            Console.ReadLine();
            uniCmd = new CommandContext(uninstallGame);
            uniCmd.Execute();
            Console.ReadLine();
            uniCmd = new CommandContext(updateGame);
            uniCmd.Execute();
            Console.ReadLine();
        }