private void GameDlg_Load(object sender, EventArgs e) { if (editMode) { Text = GlobalStrings.DlgGame_EditGame; txtId.Text = Game.Id.ToString(); txtName.Text = Game.Name; txtCategory.Text = Game.GetCatString(); chkFavorite.Checked = Game.IsFavorite(); chkHidden.Checked = Game.Hidden; txtId.ReadOnly = true; } else { Text = GlobalStrings.DlgGame_CreateGame; } }
private void GameDlg_Load(object sender, EventArgs e) { if (editMode) { Text = GlobalStrings.DlgGame_EditGame; txtId.Text = Game.Id.ToString(CultureInfo.CurrentCulture); txtName.Text = Game.Name; txtHoursPlayed.Text = Game.HoursPlayed.ToString(CultureInfo.CurrentCulture); txtCategory.Text = Game.GetCatString(); txtExecutable.Text = Game.Executable; chkFavorite.Checked = Game.IsFavorite(); chkHidden.Checked = Game.IsHidden; txtId.ReadOnly = true; } else { Text = GlobalStrings.DlgGame_CreateGame; } }
/// <summary> /// Checks to see if a game should currently be displayed, based on the state of the category list. /// </summary> /// <param name="g">Game to check</param> /// <returns>True if it should be displayed, false otherwise</returns> bool ShouldDisplayGame(GameInfo g) { if (currentProfile == null) return false; if (mtxtSearch.Text != string.Empty && g.Name.IndexOf(mtxtSearch.Text, StringComparison.CurrentCultureIgnoreCase) == -1) return false; if (!currentProfile.GameData.Games.ContainsKey(g.Id)) return false; if (g.Id < 0 && !currentProfile.IncludeShortcuts) return false; if (lstCategories.SelectedItems.Count == 0) return false; if (AdvancedCategoryFilter) { return g.IncludeGame(advFilter); } if (g.Hidden) { return (lstCategories.SelectedItems[0].Tag.ToString() == GlobalStrings.MainForm_Hidden); } if (lstCategories.SelectedItems[0].Tag.ToString() == GlobalStrings.MainForm_Uncategorized) { return !g.HasCategories(); } if (lstCategories.SelectedItems[0].Tag is Category) { if (((Category) lstCategories.SelectedItems[0].Tag).Name == GlobalStrings.MainForm_Favorite) return g.IsFavorite(); return g.ContainsCategory(lstCategories.SelectedItems[0].Tag as Category); } else { if (lstCategories.SelectedItems[0].Tag.ToString() == GlobalStrings.MainForm_All) { return true; } if (lstCategories.SelectedItems[0].Tag.ToString() == GlobalStrings.MainForm_Uncategorized) { return !g.HasCategories(); } } return false; }
void AddGameToCheckboxStates( GameInfo game, bool first ) { ignoreCheckChanges = true; if( first ) { chkFavorite.CheckState = game.IsFavorite() ? CheckState.Checked : CheckState.Unchecked; chkHidden.CheckState = game.Hidden ? CheckState.Checked : CheckState.Unchecked; } else { if( chkFavorite.CheckState != CheckState.Indeterminate ) { if( game.IsFavorite() ) { if( chkFavorite.CheckState == CheckState.Unchecked ) chkFavorite.CheckState = CheckState.Indeterminate; } else { if( chkFavorite.CheckState == CheckState.Checked ) chkFavorite.CheckState = CheckState.Indeterminate; } } if( game.Hidden ) { if( chkHidden.CheckState == CheckState.Unchecked ) chkHidden.CheckState = CheckState.Indeterminate; } else { if( chkHidden.CheckState == CheckState.Checked ) chkHidden.CheckState = CheckState.Indeterminate; } } ignoreCheckChanges = false; }
/// <summary> /// Creates a ListViewItem for the given game. /// </summary> /// <param name="g">The game the new entry should represent.</param> private ListViewItem CreateListItem( GameInfo g ) { ListViewItem item = new ListViewItem( new string[] { ( g.Id < 0 ) ? GlobalStrings.MainForm_External : g.Id.ToString(), g.Name, g.GetCatString( GlobalStrings.MainForm_Uncategorized ), g.IsFavorite() ? "X" : String.Empty, g.Hidden ? "X" : String.Empty } ); // Shortcut games show with italic font. if( g.Id < 0 ) item.Font = new Font( item.Font, item.Font.Style | FontStyle.Italic ); return item; }