private void btnSettings_Click(object sender, EventArgs e) { dlgSettings dlg = new dlgSettings(); dlg.ShowDialog(); LoadSettings(); //Reload the settings due to potential changes }
//Load the settings from the registry private void LoadSettings() { try { regkey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\86Box"); exepath = regkey.GetValue("EXEdir").ToString(); cfgpath = regkey.GetValue("CFGdir").ToString(); //This check is necessary in case the tailing backslash is not present! if (!exepath.EndsWith(@"\")) { exepath += @"\"; } if (!cfgpath.EndsWith(@"\")) { cfgpath += @"\"; } minimize = Convert.ToBoolean(regkey.GetValue("MinimizeOnVMStart")); showConsole = Convert.ToBoolean(regkey.GetValue("ShowConsole")); } catch (Exception ex) //Bad settings, retry { MessageBox.Show("86Box Manager settings are missing or corrupted. This is normal if you're running 86Box Manager for the first time. Please (re)configure the settings now.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); dlgSettings dlg = new dlgSettings(); dlg.ShowDialog(); LoadSettings(); } }