Beispiel #1
0
 /*assigns the variables to the
  * audio files and image files
  * and the sound name and category
  */
 public Sound(String soundName, SoundCateory category)
 {
     SoundName     = soundName;
     SoundCategory = category;
     SoundAudio    = String.Format("/Assets/Audio/{0}/{1}.mp3", category, soundName);
     SoundImage    = String.Format("/Assets/Icons/{0}/{0}.png", category, soundName);
 }
        //get all sounds by category
        public static void GetSoundsByCategory(ObservableCollection <Sound> sounds, SoundCateory MySoundCategory)
        {
            //call method get all sounds
            var allSounds = getSounds();
            // filter all sounds and assign all sounds to
            //there subcategory via lambda expression
            var SoundByCategory = allSounds.Where(P => P.SoundCategory == MySoundCategory).ToList();

            sounds.Clear();
            SoundByCategory.ForEach(p => sounds.Add(p));
        }