locked
Storing all .jpg files from a folder to display on flipview

    Question

  • All,

    I have been moving from developing in C# to C++. So far it has been very productive but I am still having issues when trying to convert so of my functions. The biggest issues has been visualizing the conversion of the C# to C++. At times I am not evening trying to convert but to rewrite, but I am still having problems. Below is the intial code I wrote to open the folder.

     FolderPicker^ folderPicker = ref new FolderPicker();
     folderPicker->SuggestedStartLocation = PickerLocationId::Desktop;

     create_task(folderPicker->PickSingleFolderAsync()).then([this](StorageFolder^ folder)
     {
      if (folder)
      {
       
      }
      else
      {
       
      }
     });

    Below is my C# code to load the .jpg files into a bit map image to display on a flipview.

    var queryOptions = new QueryOptions(CommonFileQuery.DefaultQuery, new[] { ".jpg" });
    var query = folder.CreateFileQueryWithOptions(queryOptions);
    var files = await query.GetFilesAsync();
    foreach (var f in files)
    {
       BitmapImage bmp = new BitmapImage();
       bmp.SetSource(await f.OpenAsync(FileAccessMode.Read));
       myImages.Add(bmp);
    }

    I hope someone can help find a jumping off point so I can continue.
    Thanks
    Grim




    Thursday, December 19, 2013 3:12 PM

All replies

  • These is demonstrated in scenario 2 of the Xaml images sample
    Thursday, December 19, 2013 4:12 PM
    Owner
  • Rob,

    I have looked at that example already. It only does one file. I am looking to load all the .jpg in the "folder".

    Grim

    Thursday, December 19, 2013 4:29 PM