Example #1
0
        public void RefreshGames()
        {
            lock (controls)
            {
                foreach (var con in controls)
                {
                    if (con.Value != null)
                    {
                        con.Value.Dispose();
                    }
                }
                this.list_Games.Controls.Clear();
                this.list_Handlers.Controls.Clear();
                controls.Clear();

                List <GameHandlerMetadata> handlers = gameManager.User.InstalledHandlers;
                for (int i = 0; i < handlers.Count; i++)
                {
                    GameHandlerMetadata handler = handlers[i];
                    NewGameHandler(handler);
                }

                List <UserGameInfo> games = gameManager.User.Games;
                for (int i = 0; i < games.Count; i++)
                {
                    UserGameInfo game = games[i];
                    NewUserGame(game);
                }

                if (games.Count == 0)
                {
                    noGamesPresent = true;
                    GameControl con = new GameControl(null);
                    con.Width = list_Games.Width;
                    con.Text  = "No games";
                    this.list_Games.Controls.Add(con);
                }

                if (handlers.Count == 0)
                {
                    noGamesPresent = true;
                    HandlerControl con = new HandlerControl(null);
                    con.Width = list_Games.Width;
                    con.Text  = "No handlers";
                    this.list_Handlers.Controls.Add(con);
                }
            }

            DPIManager.ForceUpdate();
            gameManager.User.Save();
        }
Example #2
0
        public void NewGameHandler(GameHandlerMetadata metadata)
        {
            if (noGamesPresent)
            {
                noGamesPresent = false;
                RefreshGames();
                return;
            }

            // get all Repository Game Infos
            HandlerControl con = new HandlerControl(metadata);

            con.Width = list_Games.Width;
            this.list_Handlers.Controls.Add(con);
        }
Example #3
0
        public GameList(List <GameHandlerMetadata> games)
        {
            InitializeComponent();

            GameManager manager = GameManager.Instance;

            foreach (GameHandlerMetadata game in games)
            {
                HandlerControl con = new HandlerControl(game);
                con.Width  = listGames.Width;
                con.Click += Con_Click;

                listGames.Controls.Add(con);
            }
        }