Skip to content

Commit

Permalink
Added double-click event handler to profile manager
Browse files Browse the repository at this point in the history
  • Loading branch information
FelisDiligens committed May 27, 2021
1 parent 511ca2c commit 5347b2e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
17 changes: 15 additions & 2 deletions Fo76ini/Forms/FormSettings/FormSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public FormSettings()

// Init components / assign event handler:
this.listViewGameInstances.HeaderStyle = ColumnHeaderStyle.None;
this.listViewGameInstances.DoubleClick += listViewGameInstances_DoubleClick;

this.backgroundWorkerDownloadLanguages.RunWorkerCompleted += backgroundWorkerDownloadLanguages_RunWorkerCompleted;
this.backgroundWorkerRetrieveProfileInfo.RunWorkerCompleted += backgroundWorkerRetrieveProfileInfo_RunWorkerCompleted;
Expand Down Expand Up @@ -202,12 +203,17 @@ private void UpdateGamesTab()
this.listViewGameInstances.Items.Clear();
foreach (GameInstance game in ProfileManager.Games)
{
bool isSelected = ProfileManager.IsSelected(game);

// ... add it to the list.
ListViewItem gameItem = new ListViewItem(game.Title, GetImageIndex(game.Edition));
ListViewItem gameItem = new ListViewItem(
game.Title + (isSelected ? $" [{Localization.GetString("selected")}]" : ""),
GetImageIndex(game.Edition)
);
this.listViewGameInstances.Items.Add(gameItem);

// If it is the currently selected game, then...
if (ProfileManager.IsSelected(game))
if (isSelected)
{
// ... select it in the list ...
gameItem.Selected = true;
Expand Down Expand Up @@ -561,6 +567,13 @@ private void contextMenuStripGame_Opening(object sender, CancelEventArgs e)
this.gameToolStripMenuItem.Text = ProfileManager.SelectedGame.Title;
}

private void listViewGameInstances_DoubleClick(object sender, EventArgs e)
{
if (UpdatingUI)
return;
renameGameToolStripMenuItem_Click(sender, e);
}

#endregion

#region Translations
Expand Down
1 change: 1 addition & 0 deletions Fo76ini/Interface/Translation.Shared.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ private static void AddSharedStrings()
localizedStrings["invalid"] = "Invalid";
localizedStrings["auto"] = "Auto";
localizedStrings["unknown"] = "Unknown";
localizedStrings["selected"] = "selected";
localizedStrings["nuclearwintermode"] = "Nuclear Winter";
localizedStrings["adventuremode"] = "Adventure";
localizedStrings["affectedValues"] = "Affected values";
Expand Down

0 comments on commit 5347b2e

Please sign in to comment.