Resimlerin albümünden Windows 8.1 kamerada bir resim seçmek istiyorum. Bunun için ben bile gerekli sayfasında OnActivated olayı işleyebilir düşünüyorum Bu kodu kullanılır ama onun hatasıWindows Phone 8.1 Dosya Seçici
private async void gallery_Tapped(object sender, TappedRoutedEventArgs e)
{
FileOpenPicker opener = new FileOpenPicker();
opener.ViewMode = PickerViewMode.Thumbnail;
opener.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
opener.FileTypeFilter.Add(".jpg");
opener.FileTypeFilter.Add(".jpeg");
opener.FileTypeFilter.Add(".png");
StorageFile file = await opener.PickSingleFileAsync();
if (file != null)
{
// We've now got the file. Do something with it.
var stream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read);
var bitmapImage = new Windows.UI.Xaml.Media.Imaging.BitmapImage();
await bitmapImage.SetSourceAsync(stream);
var decoder = await Windows.Graphics.Imaging.BitmapDecoder.CreateAsync(stream);
MyImage.Source=bitmapImage;
}
else
{
//OutputTextBlock.Text = "The operation may have been cancelled.";
}
}
Hata
sen [PickSingleFileAndContinue] kullanmak gerekmiyor (http://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.pickers.fileopenpicker.picksinglefileandcontinue. aspx?)? –
Ulugbek'in dediği gibi - Windows Phone'u hedefliyorsunuz ve bu yöntemleri kullanamazsınız (* PickSingleFileAsync() *), dolayısıyla dosya seçerken uygulamanız sonlandırılabilir. Yukarıdaki yöntemi kullanmalısınız - daha fazla referans ve iyi bir örnek [burada MSDN'de bulabilirsiniz] (http://msdn.microsoft.com/en-us/library/windows/apps/xaml/dn614994.aspx). – Romasz
Evet Bunu düzeltdim, ancak bu seçili dosya ile nasıl çalışılacağı void döndürüyor? –