private void buttonOK_Click(object sender, EventArgs e) { Configuration config = new Configuration(); if ((_localSettings != null) || _iniPathChanged) { DialogResult result = MessageBox.Show( "If you proceed, the selected settings file will become your new current settings.\n" + "Are you sure you want to do this?" + "\n\nWarning!\nAny changes made to the current database settings during the\n" + "current session will be lost unless you click NO and restart PicasaStarter", "Change current settings?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == DialogResult.Yes) { if (_iniPathChanged) { if (_setDefaultIniPath) { config.picasaStarterSettingsXMLPath = ""; ReturnAppSettingsDir = SettingsHelper.ConfigurationDir; } else { config.picasaStarterSettingsXMLPath = textBoxSettingsXMLPath.Text; ReturnAppSettingsDir = config.picasaStarterSettingsXMLPath; } try { SettingsHelper.SerializeConfig(config, SettingsHelper.ConfigurationDir + "\\" + SettingsHelper.ConfigFileName); } catch (Exception ex) { MessageBox.Show("Gs Error saving settings: " + ex.Message); } } ReturnPicasaSettings = _localSettings; } } ReturnPicasaExePath = PicasaExePath; this.DialogResult = DialogResult.OK; Close(); }
private void MainForm_Load(object sender, EventArgs e) { // Set version + build time in title bar this.Text = this.Text + " " + System.Diagnostics.FileVersionInfo.GetVersionInfo(Application.ExecutablePath).FileVersion + " on 2012-04-23 )"; // If Picasa exe isn't found... ask path... if (!File.Exists(_settings.PicasaExePath)) { FirstRunWizardStep1 firstRunWizardStep1 = new FirstRunWizardStep1(_settings.PicasaExePath); DialogResult result = firstRunWizardStep1.ShowDialog(); if (result == DialogResult.OK) { _settings.PicasaExePath = firstRunWizardStep1.PicasaExePath; } else { this.Close(); return; } } // If new instance... ask for spot to put configuration file... if (_configFileExists == false) { FirstRunWizardStep2 firstRunWizardStep2 = new FirstRunWizardStep2(SettingsHelper.ConfigurationDir); DialogResult result = firstRunWizardStep2.ShowDialog(); if (result == DialogResult.OK) { _appSettingsDir = firstRunWizardStep2.AppSettingsDir; //_VDriveBaseDir = Path.GetDirectoryName(_appSettingsDir); _settings = firstRunWizardStep2.Settings; } else { this.Close(); return; } Configuration config = new Configuration(); if (firstRunWizardStep2.IsDefaultLocation) { config.picasaStarterSettingsXMLPath = ""; } else { config.picasaStarterSettingsXMLPath = _appSettingsDir; } //config.configPicasaExePath = SettingsHelper.ProgramFilesx86(); try { SettingsHelper.SerializeConfig(config, SettingsHelper.ConfigurationDir + "\\" + SettingsHelper.ConfigFileName); } catch (Exception ex) { MessageBox.Show("Error saving config file: " + ex.Message); } } // Initialise all controls on the screen with the proper data ReFillPicasaDBList(false); // If the saved defaultselectedDB is valid, select it in the list... int defaultSelectedDBIndex = listBoxPicasaDBs.FindStringExact(_settings.picasaDefaultSelectedDB); if (defaultSelectedDBIndex != ListBox.NoMatches) { listBoxPicasaDBs.SelectedIndex = defaultSelectedDBIndex; //Map the directory below the PicasaStarter Directory to the Virtual drive // if the drive is not mapped and virtual drive is enabled bool xxx = IOHelper.MapVirtualDrive(_settings.picasaDBs[defaultSelectedDBIndex], _appSettingsDir); if (xxx) { MessageBox.Show("Error Mapping Virtual Drive" + "\nCheck the Virtual Drive settings and Path."); } } saveListIndex = defaultSelectedDBIndex; }