private void playRandomSound() { if (SoundFiles != null && SoundFiles.Any()) { int index = random.Next(SoundFiles.Count); PlaySoundComboBox.SelectedIndex = index; string filename = SoundFiles[index]; playSound(filename); //"Cow_Moo-Mike_Koenig-42670858.mp3"); } }
public void Drop(IDropInfo dropInfo) { var files = dropDataToFileList(dropInfo); if (!IsRunning && files.Count > 0) { var fileViewModels = files .Select(file => Path.GetFullPath(file)) .Where(fullName => !SoundFiles.Any(x => x.FullName.Equals(fullName, StringComparison.OrdinalIgnoreCase))) .Select(fullName => new SoundFileViewModel(fullName)) .ToList(); foreach (var fileViewModel in fileViewModels) { fileViewModel.IsSelected = true; fileViewModel.IsSelectedBaseVolumeFile = true; if (AudioFileManager.OpenFile(fileViewModel.FullName)) { SoundFiles.Add(fileViewModel); } } } }