OpenFilePicker no funciona en Windows Phone 8 (el método especificado no es compatible)
Estoy tratando de elegir un archivo usando:
private async void Button_Click_1(object sender, RoutedEventArgs e)
{
try
{
FileOpenPicker openPicker = new FileOpenPicker();
openPicker.ViewMode = PickerViewMode.Thumbnail;
openPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
openPicker.FileTypeFilter.Add(".jpg");
openPicker.FileTypeFilter.Add(".jpeg");
openPicker.FileTypeFilter.Add(".png");
StorageFile file = await openPicker.PickSingleFileAsync();
if (file != null)
{
// Application now has read/write access to the picked file
txt.Text = "Picked file: " + file.Name;
}
else
{
txt.Text = "Operation cancelled.";
}
}
catch (Exception exception)
{
txt.Text = exception.Message;
}
}
... pero lanza una excepción: `El método especificado no es compatible.";
Copié y pegué el código de los documentos de Windows Phone 8. Ninguna de sus muestras funciona. Pensé que tal vez me estoy perdiendo un contrato / capacidad de Documentos o lo que sea, pero ni siquiera existen en las aplicaciones de VS para teléfono.
¿Por qué no funciona esto?
Lo he rastreado hasta la primera línea del intento:
FileOpenPicker openPicker = new FileOpenPicker(); // this is the line the exception is thrown on.