/// <summary> /// Reads the application settings from the Windows Registry. /// </summary> private void LoadSettings() { try { RegistryHandler.ExtractRegistrySettings(out dbFolder, out tempFolder); Properties.Settings.Default.DatabaseFolderPath = dbFolder; Properties.Settings.Default.TempFolderPath = tempFolder; } catch (Exception ex) { RegistryHandler.DeleteRegistrySettings(); throw new RegistryAccessException("Could not access the registry settings.", ex); } try { booksManager = BooksManager.Instance; } catch (BookEntitiesException) { throw; } }
private void SetupRegistrySettings() { try { if (RegistryHandler.RegistryConfigDataExists() == false) { new OptionsForm().ShowDialog(); } } catch (Exception ex) { RegistryHandler.DeleteRegistrySettings(); throw new RegistryAccessException("Could not access the registry.", ex); } }
private void miResetConfiguration_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("Are you sure you want to reset the application's configuration?", "Application Configuration Reset", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (result == DialogResult.Yes) { RegistryHandler.DeleteRegistrySettings(); string resetMessage = String.Format("{0}{1}", "You will be able to set the new configuration the ", "next time the application is started."); MessageBox.Show(resetMessage, "Application Configuration Reset", MessageBoxButtons.OK, MessageBoxIcon.Information); } }