private void ButtonAddGame_Click(object sender, EventArgs e) { if (ComboBoxGameTitle.SelectedIndex == -1) { _ = DarkMessageBox.Show(this, "You must first specify a game title.", "No Game Title", MessageBoxIcon.Exclamation); return; } if (ComboBoxGameRegion.SelectedIndex == -1) { _ = DarkMessageBox.Show(this, "You must specify a game region.", "No Game Region", MessageBoxIcon.Exclamation); return; } var gameTitle = ComboBoxGameTitle.GetItemText(ComboBoxGameTitle.SelectedItem); var gameRegion = ComboBoxGameRegion.GetItemText(ComboBoxGameRegion.SelectedItem); var gameId = MainWindow.Database.Categories.GetCategoryByTitle(gameTitle).Id; DgvGameRegions.Rows.Add(gameTitle, gameRegion); MainWindow.Settings.UpdateGameRegion(gameId, gameRegion); LoadSavedRegions(); }
private void ComboBoxGameTitle_SelectedIndexChanged(object sender, EventArgs e) { if (ComboBoxGameTitle.SelectedIndex != -1) { ComboBoxGameRegion.Items.Clear(); var gameTitle = ComboBoxGameTitle.GetItemText(ComboBoxGameTitle.SelectedItem); var gameId = MainWindow.Database.CategoriesData.GetCategoryByTitle(gameTitle).Id; foreach (var gameRegion in MainWindow.Database.CategoriesData.GetGameRegions(gameId)) { ComboBoxGameRegion.Items.Add(gameRegion); } } ComboBoxGameRegion.Enabled = ComboBoxGameTitle.SelectedIndex != -1; }
private void ButtonAddGame_Click(object sender, EventArgs e) { if (ComboBoxGameTitle.SelectedIndex == -1) { XtraMessageBox.Show("You must first specify a game title.", "No Game Title"); return; } if (ComboBoxGameRegion.SelectedIndex == -1) { XtraMessageBox.Show("You must specify a game region for this game.", "No Game Region"); return; } var gameTitle = ComboBoxGameTitle.GetItemText(ComboBoxGameTitle.SelectedItem); var gameRegion = ComboBoxGameRegion.GetItemText(ComboBoxGameRegion.SelectedItem); var gameId = MainWindow.Database.CategoriesData.GetCategoryByTitle(gameTitle).Id; MainWindow.Settings.UpdateGameRegion(gameId, gameRegion); LoadSavedGameRegions(); }