public MainPage() { this.InitializeComponent(); SoundService.GetAllSounds().ForEach(a => Items.Add(a)); MenuItems.Add(new MenuItem { IconFile = "Assets/Icons/animals.png", Category = SoundCategory.Animals }); MenuItems.Add(new MenuItem { IconFile = "Assets/Icons/cartoon.png", Category = SoundCategory.Cartoons }); MenuItems.Add(new MenuItem { IconFile = "Assets/Icons/taunt.png", Category = SoundCategory.Taunts }); MenuItems.Add(new MenuItem { IconFile = "Assets/Icons/warning.png", Category = SoundCategory.Warnings }); }
private void AddSoundIfComplete() { if (_soundToAdd != null && !string.IsNullOrWhiteSpace(_soundToAdd.AudioFile) && !string.IsNullOrWhiteSpace(_soundToAdd.ImageFile)) { Items.Clear(); SoundService.AddSound(_soundToAdd); SoundService.GetAllSounds().ForEach(a => Items.Add(a)); _soundToAdd = null; } }
private void SearchAutoSuggestBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args) { if (string.IsNullOrWhiteSpace(sender.Text)) { Items.Clear(); SoundService.GetAllSounds().ForEach(a => Items.Add(a)); SearchAutoSuggestBox.ItemsSource = null; } else { var allSounds = SoundService.GetAllSounds(); SearchAutoSuggestBox.ItemsSource = allSounds.Where(a => a.Name.ToLower().Contains(sender.Text.ToLower())).Select(b => b.Name); } CategoryTextBlock.Text = "All Sounds"; }