Ejemplo n.º 1
0
        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;
       }
Ejemplo n.º 2
0
        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;
        }