private void FillSoundCombobox() { //Fill the list with all the sounds from the Database(non default windows ones) List <Songs> sounds = BLSongs.GetSongs().Where(s => Path.GetDirectoryName(s.SongFilePath).ToLower() != "c:\\windows\\media").OrderBy(s => s.SongFileName).ToList(); cbSound.Items.Clear(); ComboBoxItemManager.ClearComboboxItems(); if (sounds != null) { foreach (Songs item in sounds) { if (item.SongFileName != "") { cbSound.Items.Add(new ComboBoxItem(System.IO.Path.GetFileNameWithoutExtension(item.SongFileName), item)); } } } //Let's make sure the default windows System sounds are placed at the bottom List <Songs> windowsDefaultSongs = BLSongs.GetSongs().Where(s => Path.GetDirectoryName(s.SongFilePath).ToLower() == "c:\\windows\\media").OrderBy(s => s.SongFileName).ToList(); if (windowsDefaultSongs != null) { foreach (Songs item in windowsDefaultSongs) { if (item.SongFileName != "") { cbSound.Items.Add(new ComboBoxItem(System.IO.Path.GetFileNameWithoutExtension(item.SongFileName), item)); } } } }
private void LoadSongs() { lvSoundFiles.Items.Clear(); List <Songs> songs = BLSongs.GetSongs().Where(s => Path.GetDirectoryName(s.SongFilePath).ToLower() != "c:\\windows\\media").ToList(); songs = songs.OrderBy(s => s.SongFilePath).ToList(); if (songs != null && songs.Count > 0) { foreach (Songs sng in songs) { ListViewItem item = new ListViewItem(sng.SongFilePath); item.Tag = sng.Id; lvSoundFiles.Items.Add(item); } } }