Reading Image and Video from Device in Windows Phone 8.1

Reading Image and Video from device in windows phone 8.1:
  
MainPage.Xaml

  1. <Button x:Name="btnPhotos" HorizontalAlignment="Left" Margin="2,256,0,0" VerticalAlignment="Top" FontFamily="Arial" Width="388" Height="96" Click="btnPhotos_Click">  
  2.     <TextBlock x:Name="textBlock" Text="Photos" FontSize="28" Foreground="#FF7A7070" Width="210" Height="42" />   
  3. </Button>  
  4. <Button x:Name="btnVideo" HorizontalAlignment="Left" Height="99" Margin="3,366,0,0" VerticalAlignment="Top" FontFamily="Arial" Width="387" Click="btnVideo_Click">  
  5.     <TextBlock Name="textVideo" Text="Video" FontSize="28" Margin="10,0,23,0" Foreground="#FF7A7070" Width="210" Height="42">  
  6.     </TextBlock>  
  7. </Button> <b>
MainPage.Xaml.cs
  1. private async void btnPhotos_Click(object sender, RoutedEventArgs e)  
  2. {  
  3.     photosProgressBar.Visibility = Visibility.Visible;  
  4.     FileOpenPicker openPicker = new FileOpenPicker();  
  5.     openPicker.ViewMode = PickerViewMode.Thumbnail;  
  6.     openPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;  
  7.     openPicker.FileTypeFilter.Add(".jpg");  
  8.     openPicker.FileTypeFilter.Add(".jpeg");  
  9.     openPicker.FileTypeFilter.Add(".png");  
  10.     openPicker.PickMultipleFilesAndContinue();  
  11. }  
  12. private async void btnVideo_Click(object sender, RoutedEventArgs e)  
  13. {  
  14.     videoProgressBar.Visibility = Visibility.Visible;  
  15.     FileOpenPicker openPicker = new FileOpenPicker();  
  16.     openPicker.ViewMode = PickerViewMode.Thumbnail;  
  17.     openPicker.SuggestedStartLocation = PickerLocationId.VideosLibrary;  
  18.     openPicker.FileTypeFilter.Add(".mp4");  
  19.     openPicker.PickMultipleFilesAndContinue();  
  20. }  
  21. public async void ContinueFileOpenPicker(FileOpenPickerContinuationEventArgs args)  
  22. {  
  23.     IReadOnlyList < StorageFile > files = args.Files;  
  24.     if (files.Count > 0)  
  25.     {  
  26.         foreach(var item in files)  
  27.         {  
  28.             //Do your work   
  29.         }  
  30.     }  
  31. }   
  32. < b > 
App.Xaml.cs
  1. protected override void OnActivated(IActivatedEventArgs args)  
  2. {  
  3.     // Sync osync = new Sync();  
  4.     var root = Window.Current.Content as Frame;  
  5.     var sync = root.Content as Sync;  
  6.     if (sync != null && args is FileOpenPickerContinuationEventArgs)  
  7.     {  
  8.         sync.ContinueFileOpenPicker(args as FileOpenPickerContinuationEventArgs);  
  9.     }  
  10. }