c# - How to create SampleDataSource for GridApp template using images that stored at PicturesLibrary? -


i trying create datasource gridapp. images pictureslibrary using getfilesasync(). modified sampledatasource.cs: in data structure use storagefile imagepath instead of string imagepath. , of course wrote code creates bitmapimage storagefile using irandomaccessstream instead of creation bitmapimage uri.

so code can compiled doesn't work. here reasons of it: async method getfilesasync() not blocks main thread. , groupeditemspage.xaml.cs asks sampledatasource before getfilesasync() provides necessary information. cause exception typeinitializationexception.

the obvious solution use sync analog of getfilesasync(). there new problems:

  1. it seems it's impossible files knownfolders.pictureslibrary synchronously.
  2. it's whole bad idea, because if have big amount of pictures generation of groupeditemspage cause freezing.

so, how can solve problem? asking conception of solution. how should organize architecture of app?


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -