Created
March 31, 2014 19:33
-
-
Save xdumaine/9900398 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create an OpenFilePicker starting in the pictures library, viewing thumbnails | |
var filePicker = new FileOpenPicker(); | |
filePicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary; | |
filePicker.ViewMode = PickerViewMode.Thumbnail; | |
// Filter to include a sample subset of file types | |
filePicker.FileTypeFilter.Clear(); | |
filePicker.FileTypeFilter.Add(".bmp"); | |
filePicker.FileTypeFilter.Add(".png"); | |
filePicker.FileTypeFilter.Add(".jpeg"); | |
filePicker.FileTypeFilter.Add(".jpg"); | |
// Open a stream for the selected file | |
StorageFile file = await filePicker.PickSingleFileAsync(); | |
// Ensure a file was selected | |
if (file == null) | |
{ | |
// Get a stream of the file – I’ll use this for uploading | |
var stream = await file.OpenStreamForReadAsync(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment