Esempio n. 1
0
        // Constructor
        public LibrarySidebar(int gameId)
        {
            db = new MyDbContext();

            // populate public properties
            GameId = gameId;

            Game game = (from g in db.Game
                         where g.gameId == gameId
                         select g).SingleOrDefault();

            if (game == null)
            {
                return;
            }

            GameName   = game.gameName;
            GamePath   = game.gamePath;
            IsFavorite = game.isFavorite;

            LastPlayed    = game.gameLastPlayed;
            LastFinished  = game.gameLastFinished;
            TotalPlayTime = game.gameTime;
            TimesPlayed   = game.timesPlayed;

            SystemId          = game.systemId;
            SystemCode        = GSystem.GetSystemCode(SystemId);
            SystemName        = GSystem.GetSystemName(SystemId);
            SystemDescription = GSystem.GetSystemDesc(SystemId);

            if (game.gdbId != null)
            {
                gdbid = game.gdbId.Value;
            }

            AlternateTitles = game.AlternateTitles;
            Genres          = game.Genres;
            Coop            = game.Coop;
            Developer       = game.Developer;
            ESRB            = game.ESRB;
            Overview        = game.Overview;
            Players         = game.Players;
            Publisher       = game.Publisher;
            Year            = game.Year;

            Copyright         = game.Copyright;
            Country           = game.Country;
            DevelopmentStatus = game.DevelopmentStatus;
            Language          = game.Language;
            OtherFlags        = game.OtherFlags;

            if (game.ManualEditSet == true)
            {
                ManEdit = true;
            }
            else
            {
                ManEdit = false;
            }
        }
Esempio n. 2
0
        // remove all disk-based games from db for a certain system
        public static void RemoveDisks(int sysId)
        {
            MessageBoxResult result = MessageBox.Show("This operation will wipe out ALL the " + GSystem.GetSystemName(sysId) + " games in your library database (but they will not be deleted from disk)\n\nAre you sure you wish to continue?", "WARNING", MessageBoxButton.OKCancel, MessageBoxImage.Warning);

            if (result == MessageBoxResult.OK)
            {
                // get all disks for specific system
                using (var context = new MyDbContext())
                {
                    List <Game> disks = (from a in context.Game
                                         where a.systemId == sysId
                                         select a).ToList();
                    Game.DeleteGames(disks);
                    // GameListBuilder.UpdateFlag();
                }
            }
        }