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)); }
public SoundFontListEditor(String[] SFs) { InitializeComponent(); Delegate = this; for (int i = 0; i < Lis.Columns.Count; i++) { if (Properties.Settings.Default.SFColumnsSize[i] != -1) { Lis.Columns[i].Width = Properties.Settings.Default.SFColumnsSize[i]; } else { Properties.Settings.Default.SFColumnsSize[i] = Lis.Columns[i].Width; Properties.Settings.Default.Save(); } } // Attach context menu Lis.ContextMenu = LisCM; // Prepare CSFWatcher SoundFontListExtension.OpenCSFWatcher(false, null); SFlg.BackgroundImage = Properties.Resources.Question; CLi.BackgroundImage = Properties.Resources.ClearIcon; AddSF.BackgroundImage = Properties.Resources.AddSFIcon; RmvSF.BackgroundImage = Properties.Resources.RmvSFIcon; MvU.BackgroundImage = Properties.Resources.MvUpIcon; MvD.BackgroundImage = Properties.Resources.MvDwIcon; LoadToApp.BackgroundImage = Properties.Resources.ReloadIcon; EnableSF.BackgroundImage = Properties.Resources.EnableIcon; DisableSF.BackgroundImage = Properties.Resources.DisableIcon; IEL.BackgroundImage = Properties.Resources.ImportIcon; EL.BackgroundImage = Properties.Resources.ExportIcon; // Add the SoundFonts before activating the CSFWatcher if (SFs != null && SFs.Count() > 0) { foreach (String SF in SFs) { if (Path.GetExtension(SF).ToLowerInvariant() == ".sf1" | Path.GetExtension(SF).ToLowerInvariant() == ".sf2" | Path.GetExtension(SF).ToLowerInvariant() == ".sfz" | Path.GetExtension(SF).ToLowerInvariant() == ".sfark" | Path.GetExtension(SF).ToLowerInvariant() == ".sfpack") { using (AddToWhichList TF = new AddToWhichList(SF)) { if (TF.ShowDialog() == DialogResult.OK) { SelectedListBox.SelectedIndex = TF.Index; String[] TSF = new String[] { SF }; ListViewItem[] iSFs = SoundFontListExtension.AddSFToList(TSF, false, true); if (iSFs != null) { foreach (ListViewItem iSF in iSFs) { Lis.Items.Add(iSF); } } SoundFontListExtension.SaveList(ref Lis, SelectedListBox.SelectedIndex, null); } } } } } SelectedListBox.SelectedIndex = Properties.Settings.Default.LastListSelected; 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)); }