private void IEL_Click(object sender, EventArgs e) { OpenFileDialog OFD = new OpenFileDialog() { Multiselect = true, InitialDirectory = Properties.Settings.Default.LastImportExportPath, Filter = "Soundfont lists | *.sflist; *.omlist; *.txt;" }; try { if (OFD.ShowDialog(this) == DialogResult.OK) { Properties.Settings.Default.LastImportExportPath = Path.GetDirectoryName(OFD.FileNames[0]); Properties.Settings.Default.Save(); foreach (string ListW in OFD.FileNames) { SoundFontListExtension.ChangeList(-1, ListW, true, false); } SoundFontListExtension.SaveList(ref Lis, SelectedListBox.SelectedIndex, null); Program.ShowError(0, "Import finished", "The selected lists have been imported successfully to the currently selected list in the configurator.", null); } } catch (Exception ex) { ReloadListAfterError(ex); } OFD.Dispose(); }
private void SelectedListBox_SelectedIndexChanged(object sender, EventArgs e) { SelectedIndexCSF = (SelectedListBox.SelectedIndex == 0); SoundFontListExtension.ChangeList(SelectedListBox.SelectedIndex, null, false, false); Properties.Settings.Default.LastListSelected = SelectedListBox.SelectedIndex; Properties.Settings.Default.Save(); }
private void CSFHandler(object source, FileSystemEventArgs e) { if (SelectedIndexCSF && !SoundFontListExtension.StopCheck) { this.Invoke((Action) delegate { SoundFontListExtension.ChangeList(0, null, false, true); }); } }
private void SelectedListBox_SelectedIndexChanged(object sender, EventArgs e) { SelectedIndexCSF = (SelectedListBox.SelectedIndex == 0); SoundFontListExtension.ChangeList(SelectedListBox.SelectedIndex, null, false, false); Properties.Settings.Default.LastListSelected = SelectedListBox.SelectedIndex; Properties.Settings.Default.Save(); if (SelectedListBox.SelectedIndex == 0) { SoundFontListExtension.StartCSFWatcher(); } // Activate the CSFWatcher now by assigning the events, to avoid a race condition SoundFontListExtension.OpenCSFWatcher(true, new FileSystemEventHandler(CSFHandler)); }
private void ReloadListAfterError(Exception ex) { DialogResult RES = Program.ShowError( 3, "Error", String.Format( "Oh snap!\nThe configurator encountered an error while editing the following list:\n{0}\n\nDo you want to reload the list?\n\n{1}", Program.ListsPath[SelectedListBox.SelectedIndex], ex.ToString() ), null ); if (RES == DialogResult.Yes) { SoundFontListExtension.ChangeList(SelectedListBox.SelectedIndex, null, false, false); } }