Skip to content

Commit

Permalink
after reopening the settings, the last tab will be shown.
Browse files Browse the repository at this point in the history
  • Loading branch information
cadaei committed Sep 28, 2019
1 parent 67732d0 commit 99b4c58
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
9 changes: 8 additions & 1 deletion ARKBreedingStats/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ public partial class Form1 : Form
private bool reactOnSelectionChange;
private CancellationTokenSource cancelTokenLibrarySelection;
private bool clearExtractionCreatureData;
/// <summary>
/// The last tab-page opened in the settings.
/// </summary>
private int settingsLastTabPageIndex;

// 0: Health
// 1: Stamina / Charge Capacity
Expand Down Expand Up @@ -2031,8 +2035,10 @@ private void settingsToolStripMenuItem_Click(object sender, EventArgs e)
/// Displays the settings window.
/// </summary>
/// <param name="page">The tab-page displayed first</param>
private void OpenSettingsDialog(int page = 0)
private void OpenSettingsDialog(int page = -1)
{
if (page == -1)
page = settingsLastTabPageIndex;
using (Settings settingsfrm = new Settings(creatureCollection, page))
{
if (settingsfrm.ShowDialog() == DialogResult.OK)
Expand All @@ -2048,6 +2054,7 @@ private void OpenSettingsDialog(int page = 0)

SetCollectionChanged(true);
}
settingsLastTabPageIndex = settingsfrm.LastTabPageIndex;
}
}

Expand Down
9 changes: 5 additions & 4 deletions ARKBreedingStats/settings/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion ARKBreedingStats/settings/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public partial class Settings : Form
private readonly CreatureCollection cc;
private ToolTip tt;
private Dictionary<string, string> languages;

public int LastTabPageIndex;
public bool WildMaxChanged; // is needed for the speech-recognition, if wildMax is changed, the grammar has to be rebuilt
public bool LanguageChanged;

Expand Down Expand Up @@ -631,5 +631,10 @@ private void ApplyMultiplierPreset(ServerMultipliers sm, bool onlyStatMultiplier
multSetter[s].Multipliers = sm.statMultipliers[s];
}
}

private void Settings_FormClosing(object sender, FormClosingEventArgs e)
{
LastTabPageIndex = tabControlSettings.SelectedIndex;
}
}
}

0 comments on commit 99b4c58

Please sign in to comment.