예제 #1
0
        /// <summary>
        /// Loops and adds either entire or users favourites mods from the database for the given game and filter into the gridview
        /// </summary>
        /// <param name="name"></param>
        /// <param name="gameType"></param>
        /// <param name="modType"></param>
        private void LoadMods(string name, string gameType, string modType)
        {
            DgvMods.Rows.Clear();

            foreach (ModsData.ModItem modItem in Database.Mods.GetModItems(name, gameType, modType))
            {
                DgvMods.Rows.Add(
                    modItem.Id,
                    modItem.Name,
                    modItem.GetGameType(),
                    modItem.GetModType(),
                    "v" + modItem.Version,
                    modItem.CreatedBy,
                    ImageExtensions.ResizeBitmap(Resources.install, 19, 19),
                    ImageExtensions.ResizeBitmap(Resources.download_from_the_cloud, 19, 19));
            }

            DgvMods.Sort(DgvMods.Columns[1], ListSortDirection.Ascending);

            if (DgvMods.Rows.Count > 0)
            {
                DgvMods.CurrentCell = DgvMods[1, 0];
                ShowModDetails(int.Parse(DgvMods.CurrentRow.Cells[0].Value.ToString()));
                DgvMods.Enabled = true;
            }
            else
            {
                DgvMods.Enabled = false;
            }
        }
예제 #2
0
        private void GameTitle_Click(object sender, EventArgs e)
        {
            SelectedGame = Utilities.GetGameByTitle(GamesData, ((Label)sender).Text);

            LoadGameMods(SelectedGame.Id);

            ComboBoxCategory.Items.Clear();
            ComboBoxCategory.Items.Add("ANY");
            ComboBoxCategory.SelectedIndex = 0;
            DgvMods.Enabled = DgvMods.Rows.Count != 0;
            DgvMods.Sort(ColumnName, ListSortDirection.Ascending);

            UpdateGameControls();
        }