private void tabControl_Selected(object sender, TabControlEventArgs e) { GamePackageTabPage page = e.TabPage as GamePackageTabPage; // do not save if the last game tab is selected ("More") if (page == null || page == tabControl.TabPages[tabControl.TabPages.Count - 1]) { return; } // save last selected game tab Program.Settings["game"].Set("last", page.Package.Name); Program.Settings.Save(Program.VFS.GetFile("user:settings.txt", Burntime.Platform.IO.FileOpenMode.Write)); }
void InitializeTabs() { // add a tab for every game foreach (GamePackage gamePackage in Program.Games) { TabPage page = new GamePackageTabPage(gamePackage); tabControl.TabPages.Add(page); if (gamePackage.Name.Equals(Program.Settings["game"].Get("last"), StringComparison.InvariantCultureIgnoreCase)) { tabControl.SelectedIndex = tabControl.TabPages.Count - 1; } } //// add download tab //if (!Program.NoConnection) // tabControl.TabPages.Add(new DownloadsTabPage()); }