private void Btn_ok_Click(object sender, EventArgs e) { String fileFilter = ""; String sdCardDirectories = ""; // Create the setting strings... foreach (ListViewItem filter in lV_fileFilters.Items) { fileFilter = String.Format("{0}:{1}", fileFilter, filter.Text); } foreach (ListViewItem directory in lV_directories.Items) { sdCardDirectories = String.Format("{0}:{1}", sdCardDirectories, directory.Text); } // Save the strings in the settings... Properties.Settings.Default.fileFilter = fileFilter.Remove(0, 1); Properties.Settings.Default.sdCardDirectories = sdCardDirectories.Remove(0, 1); Properties.Settings.Default.Save(); // Reread the settings in the main programm... Synchronisation.ReadUserSettings(); Close(); }
public MainWindow() { InitializeComponent(); // Read user settings... Synchronisation.ReadUserSettings(); // Get the old paths... StringCollection lastSdCardPath = Properties.Settings.Default.lastSdCardPath; StringCollection lastAimFolderPath = Properties.Settings.Default.lastAimFolderPath; // Add all old paths to the combo boxes... if (lastSdCardPath != null) { foreach (string lastPath in lastSdCardPath) { this.Path_SdCard.Items.Add(lastPath); } if (this.Path_SdCard.Items.Count > 0) { this.Path_SdCard.SelectedIndex = 0; } } if (lastAimFolderPath != null) { foreach (string lastPath in lastAimFolderPath) { this.Path_aimFolder.Items.Add(lastPath); } if (this.Path_aimFolder.Items.Count > 0) { this.Path_aimFolder.SelectedIndex = 0; } } }