Exemple #1
0
        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));
                    }
                }
            }
        }
Exemple #2
0
        public ComboBoxItem(string text, object value)
        {
            this.text  = text;
            this.value = value;

            //Automatically add it to the manager's list when a new object is created
            ComboBoxItemManager.AddComboboxItem(this);
        }