The method should save the mp3 file from the installed package to the user folder using FileSavePicker . Previously, as in the examples, I use GetFileAsync , which takes a file path as a parameter in order to specify which file to save. After the method starts, the application stops at:
StorageFile file = await folder.GetFileAsync(path); The error code indicates that the parameter is set incorrectly.
private async void pause_Click(object sender, RoutedEventArgs e) { string path = "Assets/Sounds/news.mp3"; StorageFolder folder = Windows.ApplicationModel.Package.Current.InstalledLocation; StorageFile file = await folder.GetFileAsync(path); var savePicker = new FileSavePicker(); savePicker.SuggestedSaveFile = file; savePicker.SuggestedStartLocation = PickerLocationId.MusicLibrary; savePicker.FileTypeChoices.Add("SoundFile",new List<string>() { ".mp3" }); savePicker.SuggestedFileName = "SoundFile"; StorageFile newRingtone = await savePicker.PickSaveFileAsync(); if (newRingtone !=null) ... } I do not quite understand what is wrong with the path to the file. Or do I misunderstand the essence of the tool and need to use some other?
"Assets\Sounds\news.mp3"? - andreycha@or escape slashes :) - Grundy